diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-10-04 08:49:36 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-04 12:27:56 -0400 |
commit | dd464345f330c1103f93daad309e8b44845e96cf (patch) | |
tree | d5db0a50563ccc8553d5c0a0be107b32a041cf9f /tools/perf/ui/hist.c | |
parent | ae359f193a80e19166efaed7d400d1476057b865 (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/hist.c')
-rw-r--r-- | tools/perf/ui/hist.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index e3f8cd46e7d7..55b9ca8f084c 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -244,13 +244,15 @@ static int hpp__width_displ(struct perf_hpp *hpp __maybe_unused) | |||
244 | } | 244 | } |
245 | 245 | ||
246 | static int hpp__entry_displ(struct perf_hpp *hpp, | 246 | static int hpp__entry_displ(struct perf_hpp *hpp, |
247 | struct hist_entry *he __maybe_unused) | 247 | struct hist_entry *he) |
248 | { | 248 | { |
249 | struct hist_entry *pair = he->pair; | ||
250 | long displacement = pair ? pair->position - he->position : 0; | ||
249 | const char *fmt = symbol_conf.field_sep ? "%s" : "%6.6s"; | 251 | const char *fmt = symbol_conf.field_sep ? "%s" : "%6.6s"; |
250 | char buf[32] = " "; | 252 | char buf[32] = " "; |
251 | 253 | ||
252 | if (hpp->displacement) | 254 | if (displacement) |
253 | scnprintf(buf, sizeof(buf), "%+4ld", hpp->displacement); | 255 | scnprintf(buf, sizeof(buf), "%+4ld", displacement); |
254 | 256 | ||
255 | return scnprintf(hpp->buf, hpp->size, fmt, buf); | 257 | return scnprintf(hpp->buf, hpp->size, fmt, buf); |
256 | } | 258 | } |