perf stat: Add support for snapshot counters
authorJiri Olsa <jolsa@kernel.org>
Fri, 21 Nov 2014 09:31:15 +0000 (10:31 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 1 Dec 2014 23:00:31 +0000 (20:00 -0300)
The .snapshot file indicates that the provided event value is a snapshot
value. Bypassing the delta computation logic for such event.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1416562275-12404-12-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-stat.c

index 860e8ad..8910863 100644 (file)
@@ -443,7 +443,8 @@ static int read_cb(struct perf_evsel *evsel, int cpu, int thread __maybe_unused,
        case AGGR_CORE:
        case AGGR_SOCKET:
        case AGGR_NONE:
-               perf_evsel__compute_deltas(evsel, cpu, count);
+               if (!evsel->snapshot)
+                       perf_evsel__compute_deltas(evsel, cpu, count);
                perf_counts_values__scale(count, scale, NULL);
                evsel->counts->cpu[cpu] = *count;
                update_shadow_stats(evsel, count->values);
@@ -479,7 +480,8 @@ static int read_counter_aggr(struct perf_evsel *counter)
        if (read_counter(counter))
                return -1;
 
-       perf_evsel__compute_deltas(counter, -1, aggr);
+       if (!counter->snapshot)
+               perf_evsel__compute_deltas(counter, -1, aggr);
        perf_counts_values__scale(aggr, scale, &counter->counts->scaled);
 
        for (i = 0; i < 3; i++)