Commit db6d0bb8 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarJiri 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f0bf9107
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -22,10 +22,6 @@ specified perf.data files.


OPTIONS
OPTIONS
-------
-------
-M::
--displacement::
        Show position displacement relative to baseline.

-D::
-D::
--dump-raw-trace::
--dump-raw-trace::
        Dump raw trace in ASCII.
        Dump raw trace in ASCII.
+7 −22
Original line number Original line Diff line number Diff line
@@ -23,7 +23,6 @@ static char const *input_old = "perf.data.old",
		  *input_new = "perf.data";
		  *input_new = "perf.data";
static char	  diff__default_sort_order[] = "dso,symbol";
static char	  diff__default_sort_order[] = "dso,symbol";
static bool  force;
static bool  force;
static bool show_displacement;
static bool show_period;
static bool show_period;
static bool show_formula;
static bool show_formula;
static bool show_baseline_only;
static bool show_baseline_only;
@@ -296,9 +295,8 @@ static void insert_hist_entry_by_name(struct rb_root *root,
	rb_insert_color(&he->rb_node, root);
	rb_insert_color(&he->rb_node, root);
}
}


static void hists__name_resort(struct hists *self, bool sort)
static void hists__name_resort(struct hists *self)
{
{
	unsigned long position = 1;
	struct rb_root tmp = RB_ROOT;
	struct rb_root tmp = RB_ROOT;
	struct rb_node *next = rb_first(&self->entries);
	struct rb_node *next = rb_first(&self->entries);


@@ -306,15 +304,11 @@ static void hists__name_resort(struct hists *self, bool sort)
		struct hist_entry *n = rb_entry(next, struct hist_entry, rb_node);
		struct hist_entry *n = rb_entry(next, struct hist_entry, rb_node);


		next = rb_next(&n->rb_node);
		next = rb_next(&n->rb_node);
		n->position = position++;


		if (sort) {
		rb_erase(&n->rb_node, &self->entries);
		rb_erase(&n->rb_node, &self->entries);
		insert_hist_entry_by_name(&tmp, n);
		insert_hist_entry_by_name(&tmp, n);
	}
	}
	}


	if (sort)
	self->entries = tmp;
	self->entries = tmp;
}
}


@@ -339,12 +333,8 @@ static void perf_evlist__resort_hists(struct perf_evlist *evlist, bool name)


		hists__output_resort(hists);
		hists__output_resort(hists);


		/*
		if (name)
		 * The hists__name_resort only sets possition
			hists__name_resort(hists);
		 * if name is false.
		 */
		if (name || ((!name) && show_displacement))
			hists__name_resort(hists, name);
	}
	}
}
}


@@ -549,8 +539,6 @@ static const char * const diff_usage[] = {
static const struct option options[] = {
static const struct option options[] = {
	OPT_INCR('v', "verbose", &verbose,
	OPT_INCR('v', "verbose", &verbose,
		    "be more verbose (show symbol address, etc)"),
		    "be more verbose (show symbol address, etc)"),
	OPT_BOOLEAN('M', "displacement", &show_displacement,
		    "Show position displacement relative to baseline"),
	OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
	OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
		    "Show only items with match in baseline"),
		    "Show only items with match in baseline"),
	OPT_CALLBACK('c', "compute", &compute,
	OPT_CALLBACK('c', "compute", &compute,
@@ -585,7 +573,7 @@ static const struct option options[] = {
static void ui_init(void)
static void ui_init(void)
{
{
	/*
	/*
	 * Display baseline/delta/ratio/displacement/
	 * Display baseline/delta/ratio
	 * formula/periods columns.
	 * formula/periods columns.
	 */
	 */
	perf_hpp__column_enable(PERF_HPP__BASELINE);
	perf_hpp__column_enable(PERF_HPP__BASELINE);
@@ -604,9 +592,6 @@ static void ui_init(void)
		BUG_ON(1);
		BUG_ON(1);
	};
	};


	if (show_displacement)
		perf_hpp__column_enable(PERF_HPP__DISPL);

	if (show_formula)
	if (show_formula)
		perf_hpp__column_enable(PERF_HPP__FORMULA);
		perf_hpp__column_enable(PERF_HPP__FORMULA);


+0 −25
Original line number Original line Diff line number Diff line
@@ -351,30 +351,6 @@ static int hpp__entry_wdiff(struct perf_hpp *hpp, struct hist_entry *he)
	return scnprintf(hpp->buf, hpp->size, fmt, buf);
	return scnprintf(hpp->buf, hpp->size, fmt, buf);
}
}


static int hpp__header_displ(struct perf_hpp *hpp)
{
	return scnprintf(hpp->buf, hpp->size, "Displ.");
}

static int hpp__width_displ(struct perf_hpp *hpp __maybe_unused)
{
	return 6;
}

static int hpp__entry_displ(struct perf_hpp *hpp,
			    struct hist_entry *he)
{
	struct hist_entry *pair = hist_entry__next_pair(he);
	long displacement = pair ? pair->position - he->position : 0;
	const char *fmt = symbol_conf.field_sep ? "%s" : "%6.6s";
	char buf[32] = " ";

	if (displacement)
		scnprintf(buf, sizeof(buf), "%+4ld", displacement);

	return scnprintf(hpp->buf, hpp->size, fmt, buf);
}

static int hpp__header_formula(struct perf_hpp *hpp)
static int hpp__header_formula(struct perf_hpp *hpp)
{
{
	const char *fmt = symbol_conf.field_sep ? "%s" : "%70s";
	const char *fmt = symbol_conf.field_sep ? "%s" : "%70s";
@@ -427,7 +403,6 @@ struct perf_hpp_fmt perf_hpp__format[] = {
	HPP__PRINT_FNS(delta),
	HPP__PRINT_FNS(delta),
	HPP__PRINT_FNS(ratio),
	HPP__PRINT_FNS(ratio),
	HPP__PRINT_FNS(wdiff),
	HPP__PRINT_FNS(wdiff),
	HPP__PRINT_FNS(displ),
	HPP__PRINT_FNS(formula)
	HPP__PRINT_FNS(formula)
};
};


+0 −1
Original line number Original line Diff line number Diff line
@@ -154,7 +154,6 @@ enum {
	PERF_HPP__DELTA,
	PERF_HPP__DELTA,
	PERF_HPP__RATIO,
	PERF_HPP__RATIO,
	PERF_HPP__WEIGHTED_DIFF,
	PERF_HPP__WEIGHTED_DIFF,
	PERF_HPP__DISPL,
	PERF_HPP__FORMULA,
	PERF_HPP__FORMULA,


	PERF_HPP__MAX_INDEX
	PERF_HPP__MAX_INDEX