perf tools: Skip elided sort entries
When it converted sort entries to hpp formats, it missed se->elide
handling, so add it for compatibility.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 415bdee..3d028c8 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -684,6 +684,9 @@
ui_browser__gotorc(&browser->b, row, 0);
perf_hpp__for_each_format(fmt) {
+ if (perf_hpp__should_skip(fmt))
+ continue;
+
if (current_entry && browser->b.navkeypressed) {
ui_browser__set_color(&browser->b,
HE_COLORSET_SELECTED);
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 2237245..424bd21 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -180,6 +180,9 @@
col_idx = 0;
perf_hpp__for_each_format(fmt) {
+ if (perf_hpp__should_skip(fmt))
+ continue;
+
fmt->header(fmt, &hpp, hists_to_evsel(hists));
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
@@ -224,6 +227,9 @@
col_idx = 0;
perf_hpp__for_each_format(fmt) {
+ if (perf_hpp__should_skip(fmt))
+ continue;
+
if (fmt->color)
fmt->color(fmt, &hpp, h);
else
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 6c4ea9c..5ecd433 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -319,6 +319,9 @@
return 0;
perf_hpp__for_each_format(fmt) {
+ if (perf_hpp__should_skip(fmt))
+ continue;
+
/*
* If there's no field_sep, we still need
* to display initial ' '.
@@ -408,6 +411,9 @@
fprintf(fp, "# ");
perf_hpp__for_each_format(fmt) {
+ if (perf_hpp__should_skip(fmt))
+ continue;
+
if (!first)
fprintf(fp, "%s", sep ?: " ");
else
@@ -431,6 +437,9 @@
perf_hpp__for_each_format(fmt) {
unsigned int i;
+ if (perf_hpp__should_skip(fmt))
+ continue;
+
if (!first)
fprintf(fp, "%s", sep ?: " ");
else
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 9c94d72..98e13f6 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -441,6 +441,9 @@
int64_t cmp = 0;
perf_hpp__for_each_sort_list(fmt) {
+ if (perf_hpp__should_skip(fmt))
+ continue;
+
cmp = fmt->cmp(left, right);
if (cmp)
break;
@@ -456,6 +459,9 @@
int64_t cmp = 0;
perf_hpp__for_each_sort_list(fmt) {
+ if (perf_hpp__should_skip(fmt))
+ continue;
+
cmp = fmt->collapse(left, right);
if (cmp)
break;
@@ -575,6 +581,9 @@
int64_t cmp = 0;
perf_hpp__for_each_sort_list(fmt) {
+ if (perf_hpp__should_skip(fmt))
+ continue;
+
cmp = fmt->sort(a, b);
if (cmp)
break;
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 4c5c283..826ad4b 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -194,6 +194,7 @@
bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format);
bool perf_hpp__same_sort_entry(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b);
+bool perf_hpp__should_skip(struct perf_hpp_fmt *format);
typedef u64 (*hpp_field_fn)(struct hist_entry *he);
typedef int (*hpp_callback_fn)(struct perf_hpp *hpp, bool front);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 6eae4fb..5e8b08b 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1333,6 +1333,17 @@
return ret;
}
+bool perf_hpp__should_skip(struct perf_hpp_fmt *format)
+{
+ if (perf_hpp__is_sort_entry(format)) {
+ struct hpp_sort_entry *hse;
+
+ hse = container_of(format, struct hpp_sort_entry, hpp);
+ return hse->se->elide;
+ }
+ return false;
+}
+
static void sort_entry__setup_elide(struct sort_entry *se,
struct strlist *list,
const char *list_name, FILE *fp)