{
struct perf_hpp_fmt *fmt;
struct hpp_sort_entry *hse;
+ int ret = -1;
+ int r;
- fmt = he->fmt;
- if (fmt == NULL || !perf_hpp__is_sort_entry(fmt))
- return -1;
+ perf_hpp_list__for_each_format(he->hpp_list, fmt) {
+ if (!perf_hpp__is_sort_entry(fmt))
+ continue;
- hse = container_of(fmt, struct hpp_sort_entry, hpp);
- if (hse->se->se_filter == NULL)
- return -1;
+ hse = container_of(fmt, struct hpp_sort_entry, hpp);
+ if (hse->se->se_filter == NULL)
+ continue;
- return hse->se->se_filter(he, type, arg);
+ /*
+ * hist entry is filtered if any of sort key in the hpp list
+ * is applied. But it should skip non-matched filter types.
+ */
+ r = hse->se->se_filter(he, type, arg);
+ if (r >= 0) {
+ if (ret < 0)
+ ret = 0;
+ ret |= r;
+ }
+ }
+
+ return ret;
}
static int __sort_dimension__add_hpp_sort(struct sort_dimension *sd,