return -EINVAL;
}
+ if (g_ctx.hw_events) {
+ ERROR(PMU_PLUGIN ": Duplicate config for HardwareEvents.");
+ return -EINVAL;
+ }
+
g_ctx.hw_events = calloc(ci->values_num, sizeof(char *));
if (g_ctx.hw_events == NULL) {
ERROR(PMU_PLUGIN ": Failed to allocate hw events.");
char *s, *tmp;
for (s = strtok_r(events, ",", &tmp); s; s = strtok_r(NULL, ",", &tmp)) {
- /* Multiple events parsed in one entry */
- if (group_events_count == 1) {
- /* Mark previously added event as group leader */
- el->eventlist_last->group_leader = 1;
- }
-
/* Allocate memory for event struct that contains array of efd structs
for all cores */
struct event *e =
return -ENOMEM;
}
- if (resolve_event(s, &e->attr) == 0) {
- e->next = NULL;
- if (!el->eventlist)
- el->eventlist = e;
- if (el->eventlist_last)
- el->eventlist_last->next = e;
- el->eventlist_last = e;
- e->event = strdup(s);
- } else {
- DEBUG(PMU_PLUGIN ": Cannot resolve %s", s);
+ if (resolve_event(s, &e->attr) != 0) {
+ WARNING(PMU_PLUGIN ": Cannot resolve %s", s);
sfree(e);
+ continue;
}
+ /* Multiple events parsed in one entry */
+ if (group_events_count == 1) {
+ /* Mark previously added event as group leader */
+ el->eventlist_last->group_leader = 1;
+ }
+
+ e->next = NULL;
+ if (!el->eventlist)
+ el->eventlist = e;
+ if (el->eventlist_last)
+ el->eventlist_last->next = e;
+ el->eventlist_last = e;
+ e->event = strdup(s);
+
group_events_count++;
}