aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-12-06 08:22:28 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-12-09 06:46:07 -0500
commitdb6d0bb86164497f6c9ef46020cf1881953f4b08 (patch)
tree5529ab9d501cc19d7e2d26cf5f4dfac7231c1833
parentf0bf9107679f3670e5fbd52a934b7816256007f7 (diff)
perf diff: Remove displacement output option
It seems not very useful, because it's possible and event more convenient to lookup related symbol by name. Also the output value for both 'baseline' and 'new' data is quite apparent from diff output. And above all it complicates hist code factoring ;) Ditching out PERF_HPP__DISPL column with related output functions. Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com> 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@elte.hu> Cc: Ingo Molnar <mingo@kernel.org> Cc: Namhyung Kim <namhyung.kim@lge.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/20121206132228.GB1080@krava.brq.redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/Documentation/perf-diff.txt4
-rw-r--r--tools/perf/builtin-diff.c29
-rw-r--r--tools/perf/ui/hist.c25
-rw-r--r--tools/perf/util/hist.h1
4 files changed, 7 insertions, 52 deletions
diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 194f37d635df..5b3123d5721f 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -22,10 +22,6 @@ specified perf.data files.
22 22
23OPTIONS 23OPTIONS
24------- 24-------
25-M::
26--displacement::
27 Show position displacement relative to baseline.
28
29-D:: 25-D::
30--dump-raw-trace:: 26--dump-raw-trace::
31 Dump raw trace in ASCII. 27 Dump raw trace in ASCII.
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index d869029fb75e..b2e7d39f099b 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -23,7 +23,6 @@ static char const *input_old = "perf.data.old",
23 *input_new = "perf.data"; 23 *input_new = "perf.data";
24static char diff__default_sort_order[] = "dso,symbol"; 24static char diff__default_sort_order[] = "dso,symbol";
25static bool force; 25static bool force;
26static bool show_displacement;
27static bool show_period; 26static bool show_period;
28static bool show_formula; 27static bool show_formula;
29static bool show_baseline_only; 28static bool show_baseline_only;
@@ -296,9 +295,8 @@ static void insert_hist_entry_by_name(struct rb_root *root,
296 rb_insert_color(&he->rb_node, root); 295 rb_insert_color(&he->rb_node, root);
297} 296}
298 297
299static void hists__name_resort(struct hists *self, bool sort) 298static void hists__name_resort(struct hists *self)
300{ 299{
301 unsigned long position = 1;
302 struct rb_root tmp = RB_ROOT; 300 struct rb_root tmp = RB_ROOT;
303 struct rb_node *next = rb_first(&self->entries); 301 struct rb_node *next = rb_first(&self->entries);
304 302
@@ -306,16 +304,12 @@ static void hists__name_resort(struct hists *self, bool sort)
306 struct hist_entry *n = rb_entry(next, struct hist_entry, rb_node); 304 struct hist_entry *n = rb_entry(next, struct hist_entry, rb_node);
307 305
308 next = rb_next(&n->rb_node); 306 next = rb_next(&n->rb_node);
309 n->position = position++;
310 307
311 if (sort) { 308 rb_erase(&n->rb_node, &self->entries);
312 rb_erase(&n->rb_node, &self->entries); 309 insert_hist_entry_by_name(&tmp, n);
313 insert_hist_entry_by_name(&tmp, n);
314 }
315 } 310 }
316 311
317 if (sort) 312 self->entries = tmp;
318 self->entries = tmp;
319} 313}
320 314
321static struct perf_evsel *evsel_match(struct perf_evsel *evsel, 315static struct perf_evsel *evsel_match(struct perf_evsel *evsel,
@@ -339,12 +333,8 @@ static void perf_evlist__resort_hists(struct perf_evlist *evlist, bool name)
339 333
340 hists__output_resort(hists); 334 hists__output_resort(hists);
341 335
342 /* 336 if (name)
343 * The hists__name_resort only sets possition 337 hists__name_resort(hists);
344 * if name is false.
345 */
346 if (name || ((!name) && show_displacement))
347 hists__name_resort(hists, name);
348 } 338 }
349} 339}
350 340
@@ -549,8 +539,6 @@ static const char * const diff_usage[] = {
549static const struct option options[] = { 539static const struct option options[] = {
550 OPT_INCR('v', "verbose", &verbose, 540 OPT_INCR('v', "verbose", &verbose,
551 "be more verbose (show symbol address, etc)"), 541 "be more verbose (show symbol address, etc)"),
552 OPT_BOOLEAN('M', "displacement", &show_displacement,
553 "Show position displacement relative to baseline"),
554 OPT_BOOLEAN('b', "baseline-only", &show_baseline_only, 542 OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
555 "Show only items with match in baseline"), 543 "Show only items with match in baseline"),
556 OPT_CALLBACK('c', "compute", &compute, 544 OPT_CALLBACK('c', "compute", &compute,
@@ -585,7 +573,7 @@ static const struct option options[] = {
585static void ui_init(void) 573static void ui_init(void)
586{ 574{
587 /* 575 /*
588 * Display baseline/delta/ratio/displacement/ 576 * Display baseline/delta/ratio
589 * formula/periods columns. 577 * formula/periods columns.
590 */ 578 */
591 perf_hpp__column_enable(PERF_HPP__BASELINE); 579 perf_hpp__column_enable(PERF_HPP__BASELINE);
@@ -604,9 +592,6 @@ static void ui_init(void)
604 BUG_ON(1); 592 BUG_ON(1);
605 }; 593 };
606 594
607 if (show_displacement)
608 perf_hpp__column_enable(PERF_HPP__DISPL);
609
610 if (show_formula) 595 if (show_formula)
611 perf_hpp__column_enable(PERF_HPP__FORMULA); 596 perf_hpp__column_enable(PERF_HPP__FORMULA);
612 597
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 1785bab7adfd..1889c12ca81f 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -351,30 +351,6 @@ static int hpp__entry_wdiff(struct perf_hpp *hpp, struct hist_entry *he)
351 return scnprintf(hpp->buf, hpp->size, fmt, buf); 351 return scnprintf(hpp->buf, hpp->size, fmt, buf);
352} 352}
353 353
354static int hpp__header_displ(struct perf_hpp *hpp)
355{
356 return scnprintf(hpp->buf, hpp->size, "Displ.");
357}
358
359static int hpp__width_displ(struct perf_hpp *hpp __maybe_unused)
360{
361 return 6;
362}
363
364static int hpp__entry_displ(struct perf_hpp *hpp,
365 struct hist_entry *he)
366{
367 struct hist_entry *pair = hist_entry__next_pair(he);
368 long displacement = pair ? pair->position - he->position : 0;
369 const char *fmt = symbol_conf.field_sep ? "%s" : "%6.6s";
370 char buf[32] = " ";
371
372 if (displacement)
373 scnprintf(buf, sizeof(buf), "%+4ld", displacement);
374
375 return scnprintf(hpp->buf, hpp->size, fmt, buf);
376}
377
378static int hpp__header_formula(struct perf_hpp *hpp) 354static int hpp__header_formula(struct perf_hpp *hpp)
379{ 355{
380 const char *fmt = symbol_conf.field_sep ? "%s" : "%70s"; 356 const char *fmt = symbol_conf.field_sep ? "%s" : "%70s";
@@ -427,7 +403,6 @@ struct perf_hpp_fmt perf_hpp__format[] = {
427 HPP__PRINT_FNS(delta), 403 HPP__PRINT_FNS(delta),
428 HPP__PRINT_FNS(ratio), 404 HPP__PRINT_FNS(ratio),
429 HPP__PRINT_FNS(wdiff), 405 HPP__PRINT_FNS(wdiff),
430 HPP__PRINT_FNS(displ),
431 HPP__PRINT_FNS(formula) 406 HPP__PRINT_FNS(formula)
432}; 407};
433 408
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index c1b2fade8e70..5b3b0075be64 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -154,7 +154,6 @@ enum {
154 PERF_HPP__DELTA, 154 PERF_HPP__DELTA,
155 PERF_HPP__RATIO, 155 PERF_HPP__RATIO,
156 PERF_HPP__WEIGHTED_DIFF, 156 PERF_HPP__WEIGHTED_DIFF,
157 PERF_HPP__DISPL,
158 PERF_HPP__FORMULA, 157 PERF_HPP__FORMULA,
159 158
160 PERF_HPP__MAX_INDEX 159 PERF_HPP__MAX_INDEX