|
@@ -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);
|