perf tools: Pass struct perf_hpp_fmt to its callbacks
Currently ->cmp, ->collapse and ->sort callbacks doesn't pass corresponding fmt. But it'll be needed by upcoming changes in perf diff command. Suggested-by: Jiri Olsa <jolsa@kernel.org> 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-6-git-send-email-namhyung@kernel.org [ fix build by passing perf_hpp_fmt pointer to hist_entry__cmp_ methods ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ff21cef67e
commit
87bbdf768f
5 changed files with 61 additions and 18 deletions
|
@ -1304,6 +1304,37 @@ static int __sort__hpp_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
|||
return hse->se->se_snprintf(he, hpp->buf, hpp->size, len);
|
||||
}
|
||||
|
||||
static int64_t __sort__hpp_cmp(struct perf_hpp_fmt *fmt,
|
||||
struct hist_entry *a, struct hist_entry *b)
|
||||
{
|
||||
struct hpp_sort_entry *hse;
|
||||
|
||||
hse = container_of(fmt, struct hpp_sort_entry, hpp);
|
||||
return hse->se->se_cmp(a, b);
|
||||
}
|
||||
|
||||
static int64_t __sort__hpp_collapse(struct perf_hpp_fmt *fmt,
|
||||
struct hist_entry *a, struct hist_entry *b)
|
||||
{
|
||||
struct hpp_sort_entry *hse;
|
||||
int64_t (*collapse_fn)(struct hist_entry *, struct hist_entry *);
|
||||
|
||||
hse = container_of(fmt, struct hpp_sort_entry, hpp);
|
||||
collapse_fn = hse->se->se_collapse ?: hse->se->se_cmp;
|
||||
return collapse_fn(a, b);
|
||||
}
|
||||
|
||||
static int64_t __sort__hpp_sort(struct perf_hpp_fmt *fmt,
|
||||
struct hist_entry *a, struct hist_entry *b)
|
||||
{
|
||||
struct hpp_sort_entry *hse;
|
||||
int64_t (*sort_fn)(struct hist_entry *, struct hist_entry *);
|
||||
|
||||
hse = container_of(fmt, struct hpp_sort_entry, hpp);
|
||||
sort_fn = hse->se->se_sort ?: hse->se->se_cmp;
|
||||
return sort_fn(a, b);
|
||||
}
|
||||
|
||||
static struct hpp_sort_entry *
|
||||
__sort_dimension__alloc_hpp(struct sort_dimension *sd)
|
||||
{
|
||||
|
@ -1322,9 +1353,9 @@ __sort_dimension__alloc_hpp(struct sort_dimension *sd)
|
|||
hse->hpp.entry = __sort__hpp_entry;
|
||||
hse->hpp.color = NULL;
|
||||
|
||||
hse->hpp.cmp = sd->entry->se_cmp;
|
||||
hse->hpp.collapse = sd->entry->se_collapse ? : sd->entry->se_cmp;
|
||||
hse->hpp.sort = sd->entry->se_sort ? : hse->hpp.collapse;
|
||||
hse->hpp.cmp = __sort__hpp_cmp;
|
||||
hse->hpp.collapse = __sort__hpp_collapse;
|
||||
hse->hpp.sort = __sort__hpp_sort;
|
||||
|
||||
INIT_LIST_HEAD(&hse->hpp.list);
|
||||
INIT_LIST_HEAD(&hse->hpp.sort_list);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue