aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-diff.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2013-01-24 10:10:29 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-04-01 11:19:43 -0400
commit05484298cbfebbf8c8c55b000541a245bc286bec (patch)
tree1b1336957d96defc9e637faf14aebacb5b9b693a /tools/perf/builtin-diff.c
parent2fe85427e3bf65d791700d065132772fc26e4d75 (diff)
perf tools: Add support for weight v7 (modified)
perf record has a new option -W that enables weightened sampling. Add sorting support in top/report for the average weight per sample and the total weight sum. This allows to both compare relative cost per event and the total cost over the measurement period. Add the necessary glue to perf report, record and the library. v2: Merge with new hist refactoring. v3: Fix manpage. Remove value check. Rename global_weight to weight and weight to local_weight. v4: Readd sort keys to manpage v5: Move weight to end v6: Move weight to template v7: Rename weight key. Original patch from Andi modified by Stephane Eranian <eranian@google.com> to include ONLY the weight supporting code and apply to pristine 3.8.0-rc4. Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1359040242-8269-6-git-send-email-eranian@google.com [ committer note: changed to cope with fc5871ed and the hists_link perf test entry ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-diff.c')
-rw-r--r--tools/perf/builtin-diff.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index d207a97a2db1..2d0462d89a97 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -231,9 +231,10 @@ int perf_diff__formula(struct hist_entry *he, struct hist_entry *pair,
231} 231}
232 232
233static int hists__add_entry(struct hists *self, 233static int hists__add_entry(struct hists *self,
234 struct addr_location *al, u64 period) 234 struct addr_location *al, u64 period,
235 u64 weight)
235{ 236{
236 if (__hists__add_entry(self, al, NULL, period) != NULL) 237 if (__hists__add_entry(self, al, NULL, period, weight) != NULL)
237 return 0; 238 return 0;
238 return -ENOMEM; 239 return -ENOMEM;
239} 240}
@@ -255,7 +256,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
255 if (al.filtered) 256 if (al.filtered)
256 return 0; 257 return 0;
257 258
258 if (hists__add_entry(&evsel->hists, &al, sample->period)) { 259 if (hists__add_entry(&evsel->hists, &al, sample->period, sample->weight)) {
259 pr_warning("problem incrementing symbol period, skipping event\n"); 260 pr_warning("problem incrementing symbol period, skipping event\n");
260 return -1; 261 return -1;
261 } 262 }