aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/metricgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/metricgroup.c')
-rw-r--r--tools/perf/util/metricgroup.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 0ddd9c199227..1ddc3d1d0147 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -20,12 +20,10 @@
20#include "pmu.h" 20#include "pmu.h"
21#include "expr.h" 21#include "expr.h"
22#include "rblist.h" 22#include "rblist.h"
23#include "pmu.h"
24#include <string.h> 23#include <string.h>
25#include <stdbool.h> 24#include <stdbool.h>
26#include <errno.h> 25#include <errno.h>
27#include "pmu-events/pmu-events.h" 26#include "pmu-events/pmu-events.h"
28#include "strbuf.h"
29#include "strlist.h" 27#include "strlist.h"
30#include <assert.h> 28#include <assert.h>
31#include <ctype.h> 29#include <ctype.h>
@@ -38,6 +36,10 @@ struct metric_event *metricgroup__lookup(struct rblist *metric_events,
38 struct metric_event me = { 36 struct metric_event me = {
39 .evsel = evsel 37 .evsel = evsel
40 }; 38 };
39
40 if (!metric_events)
41 return NULL;
42
41 nd = rblist__find(metric_events, &me); 43 nd = rblist__find(metric_events, &me);
42 if (nd) 44 if (nd)
43 return container_of(nd, struct metric_event, nd); 45 return container_of(nd, struct metric_event, nd);
@@ -270,7 +272,7 @@ static void metricgroup__print_strlist(struct strlist *metrics, bool raw)
270void metricgroup__print(bool metrics, bool metricgroups, char *filter, 272void metricgroup__print(bool metrics, bool metricgroups, char *filter,
271 bool raw) 273 bool raw)
272{ 274{
273 struct pmu_events_map *map = perf_pmu__find_map(); 275 struct pmu_events_map *map = perf_pmu__find_map(NULL);
274 struct pmu_event *pe; 276 struct pmu_event *pe;
275 int i; 277 int i;
276 struct rblist groups; 278 struct rblist groups;
@@ -368,7 +370,7 @@ void metricgroup__print(bool metrics, bool metricgroups, char *filter,
368static int metricgroup__add_metric(const char *metric, struct strbuf *events, 370static int metricgroup__add_metric(const char *metric, struct strbuf *events,
369 struct list_head *group_list) 371 struct list_head *group_list)
370{ 372{
371 struct pmu_events_map *map = perf_pmu__find_map(); 373 struct pmu_events_map *map = perf_pmu__find_map(NULL);
372 struct pmu_event *pe; 374 struct pmu_event *pe;
373 int ret = -EINVAL; 375 int ret = -EINVAL;
374 int i, j; 376 int i, j;