summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/hist.h3
-rw-r--r--tools/perf/util/sort.c33
2 files changed, 36 insertions, 0 deletions
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 97baa1d6ae5f..044419b3be7c 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -301,6 +301,9 @@ void perf_hpp__append_sort_keys(struct perf_hpp_list *list);
bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format);
bool perf_hpp__is_dynamic_entry(struct perf_hpp_fmt *format);
bool perf_hpp__defined_dynamic_entry(struct perf_hpp_fmt *fmt, struct hists *hists);
+bool perf_hpp__is_trace_entry(struct perf_hpp_fmt *fmt);
+bool perf_hpp__is_srcline_entry(struct perf_hpp_fmt *fmt);
+bool perf_hpp__is_srcfile_entry(struct perf_hpp_fmt *fmt);
static inline bool perf_hpp__should_skip(struct perf_hpp_fmt *format,
struct hists *hists)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 4175b2944ff9..358035c2c327 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1391,6 +1391,39 @@ bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format)
return format->header == __sort__hpp_header;
}
+bool perf_hpp__is_trace_entry(struct perf_hpp_fmt *fmt)
+{
+ struct hpp_sort_entry *hse;
+
+ if (!perf_hpp__is_sort_entry(fmt))
+ return false;
+
+ hse = container_of(fmt, struct hpp_sort_entry, hpp);
+ return hse->se == &sort_trace;
+}
+
+bool perf_hpp__is_srcline_entry(struct perf_hpp_fmt *fmt)
+{
+ struct hpp_sort_entry *hse;
+
+ if (!perf_hpp__is_sort_entry(fmt))
+ return false;
+
+ hse = container_of(fmt, struct hpp_sort_entry, hpp);
+ return hse->se == &sort_srcline;
+}
+
+bool perf_hpp__is_srcfile_entry(struct perf_hpp_fmt *fmt)
+{
+ struct hpp_sort_entry *hse;
+
+ if (!perf_hpp__is_sort_entry(fmt))
+ return false;
+
+ hse = container_of(fmt, struct hpp_sort_entry, hpp);
+ return hse->se == &sort_srcfile;
+}
+
static bool __sort__hpp_equal(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b)
{
struct hpp_sort_entry *hse_a;