| 61 | } |
| 62 | |
| 63 | bool ParsePmuArg(const char* counterIdxArg, |
| 64 | const char* eventIdArg, |
| 65 | std::array<int, RunnerOptions::kMaxNumCounters>& counters) |
| 66 | { |
| 67 | constexpr size_t kMaxPmuEventId = 255; |
| 68 | |
| 69 | try { |
| 70 | if (RunnerOptions::kMaxNumCounters == 0) { |
| 71 | throw std::runtime_error("Error: PMU counters are not available in this build"); |
| 72 | } |
| 73 | |
| 74 | const int counterIdx = PmuStrToInt(counterIdxArg, |
| 75 | RunnerOptions::kMaxNumCounters - 1, |
| 76 | "invalid PMU counter index"); |
| 77 | const int eventId = PmuStrToInt(eventIdArg, kMaxPmuEventId, "invalid PMU event ID"); |
| 78 | counters[static_cast<size_t>(counterIdx)] = eventId; |
| 79 | return true; |
| 80 | } catch (const std::exception& err) { |
| 81 | std::cerr << err.what() << "\n"; |
| 82 | return false; |
| 83 | } |
| 84 | } |
| 85 | #endif |
| 86 | |
| 87 | int ToGetoptArgument(CliOptionArgument argument) |
no test coverage detected