lkml.org 
[lkml]   [2017]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 4/5] perf, tools: Add fallback in perf_evsel__nr_cpus for no map
Date
From: Andi Kleen <ak@linux.intel.com>

Support the case of the event having no cpumap in perf_evsel__nr_cpus.
Just return 1 in this case. This can happen in perf script
when it uses the perf stat shadow functions.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/util/evsel.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index db658785d828..25f21cde8826 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -157,7 +157,8 @@ static inline struct cpu_map *perf_evsel__cpus(struct perf_evsel *evsel)

static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel)
{
- return perf_evsel__cpus(evsel)->nr;
+ struct cpu_map *map = perf_evsel__cpus(evsel);
+ return map ? map->nr : 1;
}

void perf_counts_values__scale(struct perf_counts_values *count,
--
2.13.6
\
 
 \ /
  Last update: 2017-11-09 15:56    [W:0.089 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site