<commit_before>/**
* Copyright (C) 2014, BMW Car IT GmbH
* Author: <NAME> (<EMAIL>)
*
* This software is licensed under BSD 3-clause License
* (see http://spdx.org/licenses/BSD-3-Clause).
**/

#include "Config.h"
#include "ArgumentParser.h"

ArgumentParser::ArgumentParser()
{
}

bool ArgumentParser::parseArgs(int argc, char* argv[])
{
	Config* config = Config::getConfig();
	config->loops = 1000;
	config->timeout_us = 1000;
	config->testnodeRT = false;
	bool error = false;
	for(int i = 1; i < argc; i++)
	{
		std::string arg(argv[i]);
		if(arg.compare("--rtSched") == 0)
		{
			std::string val(argv[i+1]);
			if(val.compare("0") == 0)
			{
				config->testnodeRT = false;
			} else if(val.compare("RR") == 0)
			{
				config->testnodeRT = true;
				config->fifoScheduling = false;
			} else if(val.compare("FIFO") == 0)
			{
				config->testnodeRT = true;
				config->fifoScheduling = true;
			} else {
				error = true;
				continue;
			}
			i++;
		} else if(arg.compare("--repetitions") == 0)
		{
			config->loops = atoi(argv[i+1]);
			i++;
		} else if(arg.compare("--timeout") == 0)
		{
			config->timeout_us = atoi(argv[i+1]);
			i++;
		} else if(arg.compare("--filePrefix") == 0)
		{
			config->namePrefix = std::string(argv[i+1]);
			i++;
		} else if(arg.compare("--busy") == 0)
		{
			config->busyMode = true;
		}
	}
	return !error;
}

std::string ArgumentParser::getUsage()
{
	return "Args: [--timeout <timeout(microseconds)>] [--repetitions <amount_repetitions>] [--rtSched <0(normalPriority)/RR/FIFO>] [--filePrefix <file_prefix>] [--busy]";
}

ArgumentParser::~ArgumentParser()
{
}<commit_msg>timer_tests: Shorten argument specifiers<commit_after>/**
* Copyright (C) 2014, BMW Car IT GmbH
* Author: <NAME> (<EMAIL>)
*
* This software is licensed under BSD 3-clause License
* (see http://spdx.org/licenses/BSD-3-Clause).
**/

#include "Config.h"
#include "ArgumentParser.h"

ArgumentParser::ArgumentParser()
{
}

bool ArgumentParser::parseArgs(int argc, char* argv[])
{
	Config* config = Config::getConfig();
	config->loops = 1000;
	config->timeout_us = 1000;
	config->testnodeRT = false;
	bool error = false;
	for(int i = 1; i < argc; i++)
	{
		std::string arg(argv[i]);
		if(arg.compare("--rtSched") == 0)
		{
			std::string val(argv[i+1]);
			if(val.compare("0") == 0)
			{
				config->testnodeRT = false;
			} else if(val.compare("RR") == 0)
			{
				config->testnodeRT = true;
				config->fifoScheduling = false;
			} else if(val.compare("FIFO") == 0)
			{
				config->testnodeRT = true;
				config->fifoScheduling = true;
			} else {
				error = true;
				continue;
			}
			i++;
		} else if(arg.compare("--rpts") == 0)
		{
			config->loops = atoi(argv[i+1]);
			i++;
		} else if(arg.compare("--to") == 0)
		{
			config->timeout_us = atoi(argv[i+1]);
			i++;
		} else if(arg.compare("--fp") == 0)
		{
			config->namePrefix = std::string(argv[i+1]);
			i++;
		} else if(arg.compare("--busy") == 0)
		{
			config->busyMode = atoi(argv[i+1]);
			i++;
		}
	}
	return !error;
}

std::string ArgumentParser::getUsage()
{
	return "Args: [--to <timeout(microseconds)>] [--rpts <repetitions>] [--rtSched <0/RR/FIFO>] [--fp <file_prefix>] [--busy <0/1>]";
}

ArgumentParser::~ArgumentParser()
{
}
{'fraction_non_alphanumeric': 0.20842433697347895, 'fraction_numerical': 0.01903276131045242, 'mean_word_length': 3.5410764872521248, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3812234', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1221, 'n_words': 239}