// core_groups_list_t cores;
// struct eventlist *event_list;
bool dispatch_cloned_pmus;
+ bool all_events;
intel_pmu_entity_t *entl;
};
return -EINVAL;
}
+ // check if all events has been requested
+ for (int i = 0; i < ci->values_num; i++) {
+ if (ci->values[i].type != OCONFIG_TYPE_STRING) {
+ WARNING(PMU_PLUGIN ": The %s option requires string arguments.", ci->key);
+ continue;
+ }
+
+ if(strcasecmp(ci->values[i].value.string, "All") == 0) {
+ INFO(PMU_PLUGIN ": Requested all events.");
+ g_ctx.all_events = true;
+ return 0;
+ }
+ }
+
ent->hw_events = calloc(ci->values_num, sizeof(*ent->hw_events));
if (ent->hw_events == NULL) {
ERROR(PMU_PLUGIN ": Failed to allocate hw events.");
return 0;
}
+static int pmu_count_all_events(void *data, char *name, char *event, char *desc) {
+ intel_pmu_entity_t *ent = data;
+ ent->hw_events_count++;
+ return 0;
+}
+
+static int pmu_read_all_events(void *data, char *name, char *event, char *desc) {
+ static int event_counter = 0;
+ intel_pmu_entity_t *ent = data;
+
+ ent->hw_events[event_counter] = strdup(name);
+ if (ent->hw_events[event_counter] == NULL) {
+ ERROR(PMU_PLUGIN ": Failed to allocate hw events entry.");
+ return -ENOMEM;
+ }
+
+ event_counter++;
+
+ return 0;
+}
+
static int pmu_init(void) {
int ret;
}
}
+ /* write all events from provided EventList into hw_events */
+ if(g_ctx.all_events) {
+ for (intel_pmu_entity_t *ent = g_ctx.entl; ent != NULL; ent = ent->next) {
+ walk_events(pmu_count_all_events, ent);
+ // allocating memory for all events
+ ent->hw_events = calloc(ent->hw_events_count, sizeof(*ent->hw_events));
+ if (ent->hw_events == NULL) {
+ ERROR(PMU_PLUGIN ": Failed to allocate hw events.");
+ return -ENOMEM;
+ }
+
+ walk_events(pmu_read_all_events, ent);
+ }
+ }
+
for (intel_pmu_entity_t *ent = g_ctx.entl; ent != NULL; ent = ent->next) {
if (ent->hw_events_count == 0) {
ERROR(PMU_PLUGIN ": No events were setup in `HardwareEvents` option.");