MCPcopy Create free account
hub / github.com/Arm-Examples/ML-examples / ParsePmuArg

Function ParsePmuArg

ethos-u-corstone-1000/app/src/common/CliOptions.cpp:63–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63bool 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
87int ToGetoptArgument(CliOptionArgument argument)

Callers 1

ParseCliOptionsFunction · 0.85

Calls 1

PmuStrToIntFunction · 0.85

Tested by

no test coverage detected