aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/stdio/hist.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-10-04 08:49:36 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-04 12:27:56 -0400
commitdd464345f330c1103f93daad309e8b44845e96cf (patch)
treed5db0a50563ccc8553d5c0a0be107b32a041cf9f /tools/perf/ui/stdio/hist.c
parentae359f193a80e19166efaed7d400d1476057b865 (diff)
perf diff: Refactor diff displacement possition info
Moving the position calculation into the diff command, so the position as prepared inside struct hist_entry data and there's no need to compute in the output display path. Removing 'displacement' from struct perf_hpp as it is no longer needed. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1349354994-17853-3-git-send-email-namhyung@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/stdio/hist.c')
-rw-r--r--tools/perf/ui/stdio/hist.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 882461a42830..d7405f064e88 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -308,7 +308,7 @@ static size_t hist_entry__callchain_fprintf(struct hist_entry *he,
308 308
309static int hist_entry__fprintf(struct hist_entry *he, size_t size, 309static int hist_entry__fprintf(struct hist_entry *he, size_t size,
310 struct hists *hists, struct hists *pair_hists, 310 struct hists *hists, struct hists *pair_hists,
311 long displacement, u64 total_period, FILE *fp) 311 u64 total_period, FILE *fp)
312{ 312{
313 char bf[512]; 313 char bf[512];
314 int ret; 314 int ret;
@@ -316,7 +316,6 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
316 .buf = bf, 316 .buf = bf,
317 .size = size, 317 .size = size,
318 .total_period = total_period, 318 .total_period = total_period,
319 .displacement = displacement,
320 .ptr = pair_hists, 319 .ptr = pair_hists,
321 }; 320 };
322 bool color = !symbol_conf.field_sep; 321 bool color = !symbol_conf.field_sep;
@@ -337,15 +336,13 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
337} 336}
338 337
339size_t hists__fprintf(struct hists *hists, struct hists *pair, 338size_t hists__fprintf(struct hists *hists, struct hists *pair,
340 bool show_displacement, bool show_header, int max_rows, 339 bool show_header, int max_rows,
341 int max_cols, FILE *fp) 340 int max_cols, FILE *fp)
342{ 341{
343 struct sort_entry *se; 342 struct sort_entry *se;
344 struct rb_node *nd; 343 struct rb_node *nd;
345 size_t ret = 0; 344 size_t ret = 0;
346 u64 total_period; 345 u64 total_period;
347 unsigned long position = 1;
348 long displacement = 0;
349 unsigned int width; 346 unsigned int width;
350 const char *sep = symbol_conf.field_sep; 347 const char *sep = symbol_conf.field_sep;
351 const char *col_width = symbol_conf.col_width_list_str; 348 const char *col_width = symbol_conf.col_width_list_str;
@@ -449,15 +446,7 @@ print_entries:
449 if (h->filtered) 446 if (h->filtered)
450 continue; 447 continue;
451 448
452 if (show_displacement) { 449 ret += hist_entry__fprintf(h, max_cols, hists, pair,
453 if (h->pair != NULL)
454 displacement = ((long)h->pair->position -
455 (long)position);
456 else
457 displacement = 0;
458 ++position;
459 }
460 ret += hist_entry__fprintf(h, max_cols, hists, pair, displacement,
461 total_period, fp); 450 total_period, fp);
462 451
463 if (max_rows && ++nr_rows >= max_rows) 452 if (max_rows && ++nr_rows >= max_rows)