@@ -65,6 +65,7 @@ void print_usage(const string & progname)
65
65
cout << " -e cha/config=0,name=UNC_CHA_CLOCKTICKS/ -e imc/fixed,name=DRAM_CLOCKS/\n " ;
66
66
#ifdef PCM_SIMDJSON_AVAILABLE
67
67
cout << " -e NAME where the NAME is an event from https://github.com/intel/perfmon event lists\n " ;
68
+ cout << " -? | /? => print all events that can be monitored on the host platform along with a description\n " ;
68
69
cout << " -ep path | /ep path => path to event list directory (default is the current directory)\n " ;
69
70
#endif
70
71
cout << " -yc | --yescores | /yc => enable specific cores to output\n " ;
@@ -364,7 +365,7 @@ bool initPMUEventMap()
364
365
catch (std::exception& e)
365
366
{
366
367
cerr << " Error while opening and/or parsing " << path << " : " << e.what () << " \n " ;
367
- printError ();
368
+ printError ();
368
369
return false ;
369
370
}
370
371
}
@@ -431,6 +432,15 @@ class EventMap {
431
432
return res;
432
433
}
433
434
435
+ static void print_event_description (const std::string &eventStr) {
436
+ if (PMUEventMapJSON.find (eventStr) != PMUEventMapJSON.end ()) {
437
+ const auto eventObj = PMUEventMapJSON[eventStr];
438
+ for (const auto & key : {" BriefDescription" , " PublicDescription" })
439
+ std::cout << key << " : " << eventObj[key] << " \n " ;
440
+ return ;
441
+ }
442
+ }
443
+
434
444
static void print_event (const std::string &eventStr) {
435
445
if (PMUEventMapJSON.find (eventStr) != PMUEventMapJSON.end ()) {
436
446
const auto eventObj = PMUEventMapJSON[eventStr];
@@ -454,6 +464,21 @@ class EventMap {
454
464
}
455
465
};
456
466
467
+ void printAllEventDescriptions ()
468
+ {
469
+ if (initPMUEventMap () == false )
470
+ {
471
+ cerr << " ERROR: PMU Event map can not be initialized\n " ;
472
+ return ;
473
+ }
474
+ for (const auto & event : PMUEventMapJSON)
475
+ {
476
+ std::cout << event.first << " \n " ;
477
+ EventMap::print_event_description (event.first );
478
+ std::cout << " \n " ;
479
+ }
480
+ }
481
+
457
482
AddEventStatus addEventFromDB (PCM::RawPMUConfigs& curPMUConfigs, string fullEventStr)
458
483
{
459
484
if (initPMUEventMap () == false )
@@ -2481,6 +2506,13 @@ int mainThrows(int argc, char * argv[])
2481
2506
extendPrintout = true ;
2482
2507
continue ;
2483
2508
}
2509
+ #if PCM_SIMDJSON_AVAILABLE
2510
+ else if (check_argument_equals (*argv, {" -?" , " /?" }))
2511
+ {
2512
+ printAllEventDescriptions ();
2513
+ return 0 ;
2514
+ }
2515
+ #endif
2484
2516
else if (check_argument_equals (*argv, {" -single-header" , " /single-header" }))
2485
2517
{
2486
2518
singleHeader = true ;
0 commit comments