diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-06-26 12:29:09 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-26 17:11:26 +0300 |
commit | 1ac77e1ce8654ec94ada0c508d58ba80a4647fba (patch) | |
tree | af641ba0dc1fadca7bd3a729b17535aafe49e3de /tools/perf/util/stat.h | |
parent | 134aa44f6bff6b967efb85255ee9e8982cb8e486 (diff) | |
download | linux-1ac77e1ce8654ec94ada0c508d58ba80a4647fba.tar.xz |
perf stat: Introduce perf_counts function
Introducing perf_counts function, that returns
'struct perf_counts_values' pointer for given cpu.
Also moving perf_counts* structures into stat.h.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1435310967-14570-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/stat.h')
-rw-r--r-- | tools/perf/util/stat.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 093dc3cb28dd..5e43348836a6 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -31,6 +31,29 @@ enum aggr_mode { AGGR_CORE, }; +struct perf_counts_values { + union { + struct { + u64 val; + u64 ena; + u64 run; + }; + u64 values[3]; + }; +}; + +struct perf_counts { + s8 scaled; + struct perf_counts_values aggr; + struct perf_counts_values cpu[]; +}; + +static inline struct perf_counts_values* +perf_counts(struct perf_counts *counts, int cpu) +{ + return &counts->cpu[cpu]; +} + void update_stats(struct stats *stats, u64 val); double avg_stats(struct stats *stats); double stddev_stats(struct stats *stats); |