19 #include <rte_config.h> 21 #include <rte_debug.h> 26 static int parse_input_parameter(std::string executable, std::string option)
28 std::size_t delim_pos = option.find(
"=");
29 std::string param = option.substr(delim_pos + 1);
33 return std::stoi(param);
35 catch(std::logic_error &e)
37 std::cout << executable <<
": invalid argument '"<< param <<
"' for '" << option <<
"'" << std::endl;
38 std::cout <<
"Try '" << executable <<
" --usage' for more information." << std::endl;
46 int main(
int argc,
char** argv) {
50 ::testing::GTEST_FLAG(output) =
"xml:test_results.xml";
52 ::testing::InitGoogleTest(&argc, argv);
54 const std::string executable = argv[0];
56 for(
int index = 1; index < argc; index++) {
58 const std::string option = argv[index];
60 if (option.find(
"--nb_repetitions=") != std::string::npos)
64 else if (option.find(
"--nb_loops=") != std::string::npos)
68 else if (option.find(
"--cpu_nb=") != std::string::npos)
73 std::cout << std::endl <<
"Warning: Core #0 is running the VM's OS. " 74 <<
"Measurements won't be accurate. It shouldn't be used!" 75 << std::endl << std::endl;
78 else if (!option.compare(
"--usage"))
80 std::cout <<
"Usage: " << executable <<
" [GTEST_OPTION]... [OPTION]..." << std::endl;
81 std::cout <<
"Runs unittests with given gtest options." << std::endl;
82 std::cout << std::endl;
83 std::cout <<
"Available options: " << std::endl;
84 std::cout <<
"--nb_repetitions=NUMBER Sets how many times results are measured" << std::endl;
85 std::cout <<
"--nb_loops=NUMBER Sets how many times function is called per repetition" 87 std::cout <<
"--cpu_nb=NUMBER Sets core number to run tests on" << std::endl;
88 std::cout <<
"--usage Prints this message" << std::endl;
94 std::cout << executable <<
": inavlid option " << option << std::endl;
95 std::cout <<
"Try '" << executable <<
" --usage' for more information." << std::endl;
103 if(xranlib->
SetUp() < 0) {
107 all_test_ret = RUN_ALL_TESTS();
111 if(xranlib !=
nullptr) {
-
-
-
-
int main(int argc, char **argv)
-
-
-
-
-
-