diff options
author | Namhyung Kim <namhyung@kernel.org> | 2015-01-07 19:45:45 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-01-21 11:24:34 -0500 |
commit | ff21cef67e85ae77682560973b8c80ef64125221 (patch) | |
tree | 26f37b4f19201108231cf0d82ab903299143c39b /tools/perf | |
parent | ec3d07cb630da5da3ccfdf2b2f5472cadedb9470 (diff) |
perf diff: Introduce fmt_to_data_file() helper
The fmt_to_data_file() is to retrieve struct data__file from
perf_hpp_fmt which is embedded in diff_hpp_fmt. It'll be used by sort
callback functions later.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1420677949-6719-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-diff.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 3f86737da2c4..ae8f62151b34 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -390,6 +390,15 @@ static void perf_evlist__collapse_resort(struct perf_evlist *evlist) | |||
390 | } | 390 | } |
391 | } | 391 | } |
392 | 392 | ||
393 | static struct data__file *fmt_to_data_file(struct perf_hpp_fmt *fmt) | ||
394 | { | ||
395 | struct diff_hpp_fmt *dfmt = container_of(fmt, struct diff_hpp_fmt, fmt); | ||
396 | void *ptr = dfmt - dfmt->idx; | ||
397 | struct data__file *d = container_of(ptr, struct data__file, fmt); | ||
398 | |||
399 | return d; | ||
400 | } | ||
401 | |||
393 | static struct hist_entry* | 402 | static struct hist_entry* |
394 | get_pair_data(struct hist_entry *he, struct data__file *d) | 403 | get_pair_data(struct hist_entry *he, struct data__file *d) |
395 | { | 404 | { |
@@ -407,8 +416,7 @@ get_pair_data(struct hist_entry *he, struct data__file *d) | |||
407 | static struct hist_entry* | 416 | static struct hist_entry* |
408 | get_pair_fmt(struct hist_entry *he, struct diff_hpp_fmt *dfmt) | 417 | get_pair_fmt(struct hist_entry *he, struct diff_hpp_fmt *dfmt) |
409 | { | 418 | { |
410 | void *ptr = dfmt - dfmt->idx; | 419 | struct data__file *d = fmt_to_data_file(&dfmt->fmt); |
411 | struct data__file *d = container_of(ptr, struct data__file, fmt); | ||
412 | 420 | ||
413 | return get_pair_data(he, d); | 421 | return get_pair_data(he, d); |
414 | } | 422 | } |