Skip to content

Commit e67d49a

Browse files
namhyungolsajiri
authored andcommitted
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> Link: http://lkml.kernel.org/r/1400480762-22852-16-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
1 parent 6fe8c26 commit e67d49a

6 files changed

Lines changed: 42 additions & 0 deletions

File tree

‎tools/perf/ui/browsers/hists.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,9 @@ static int hist_browser__show_entry(struct hist_browser *browser,
711711
ui_browser__gotorc(&browser->b, row, 0);
712712

713713
perf_hpp__for_each_format(fmt) {
714+
if (perf_hpp__should_skip(fmt))
715+
continue;
716+
714717
if (current_entry && browser->b.navkeypressed) {
715718
ui_browser__set_color(&browser->b,
716719
HE_COLORSET_SELECTED);
@@ -1100,6 +1103,9 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,
11001103
printed += fprintf(fp, "%c ", folded_sign);
11011104

11021105
perf_hpp__for_each_format(fmt) {
1106+
if (perf_hpp__should_skip(fmt))
1107+
continue;
1108+
11031109
if (!first) {
11041110
ret = scnprintf(hpp.buf, hpp.size, " ");
11051111
advance_hpp(&hpp, ret);

‎tools/perf/ui/gtk/hists.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
178178
col_idx = 0;
179179

180180
perf_hpp__for_each_format(fmt) {
181+
if (perf_hpp__should_skip(fmt))
182+
continue;
183+
181184
fmt->header(fmt, &hpp, hists_to_evsel(hists));
182185

183186
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
@@ -222,6 +225,9 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
222225
col_idx = 0;
223226

224227
perf_hpp__for_each_format(fmt) {
228+
if (perf_hpp__should_skip(fmt))
229+
continue;
230+
225231
if (fmt->color)
226232
fmt->color(fmt, &hpp, h);
227233
else

‎tools/perf/ui/stdio/hist.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ static int hist_entry__snprintf(struct hist_entry *he, struct perf_hpp *hpp)
318318
return 0;
319319

320320
perf_hpp__for_each_format(fmt) {
321+
if (perf_hpp__should_skip(fmt))
322+
continue;
323+
321324
/*
322325
* If there's no field_sep, we still need
323326
* to display initial ' '.
@@ -407,6 +410,9 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
407410
fprintf(fp, "# ");
408411

409412
perf_hpp__for_each_format(fmt) {
413+
if (perf_hpp__should_skip(fmt))
414+
continue;
415+
410416
if (!first)
411417
fprintf(fp, "%s", sep ?: " ");
412418
else
@@ -430,6 +436,9 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
430436
perf_hpp__for_each_format(fmt) {
431437
unsigned int i;
432438

439+
if (perf_hpp__should_skip(fmt))
440+
continue;
441+
433442
if (!first)
434443
fprintf(fp, "%s", sep ?: " ");
435444
else

‎tools/perf/util/hist.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
436436
int64_t cmp = 0;
437437

438438
perf_hpp__for_each_sort_list(fmt) {
439+
if (perf_hpp__should_skip(fmt))
440+
continue;
441+
439442
cmp = fmt->cmp(left, right);
440443
if (cmp)
441444
break;
@@ -451,6 +454,9 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
451454
int64_t cmp = 0;
452455

453456
perf_hpp__for_each_sort_list(fmt) {
457+
if (perf_hpp__should_skip(fmt))
458+
continue;
459+
454460
cmp = fmt->collapse(left, right);
455461
if (cmp)
456462
break;
@@ -570,6 +576,9 @@ static int hist_entry__sort(struct hist_entry *a, struct hist_entry *b)
570576
int64_t cmp = 0;
571577

572578
perf_hpp__for_each_sort_list(fmt) {
579+
if (perf_hpp__should_skip(fmt))
580+
continue;
581+
573582
cmp = fmt->sort(a, b);
574583
if (cmp)
575584
break;

‎tools/perf/util/hist.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ void perf_hpp__append_sort_keys(void);
201201

202202
bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format);
203203
bool perf_hpp__same_sort_entry(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b);
204+
bool perf_hpp__should_skip(struct perf_hpp_fmt *format);
204205

205206
typedef u64 (*hpp_field_fn)(struct hist_entry *he);
206207
typedef int (*hpp_callback_fn)(struct perf_hpp *hpp, bool front);

‎tools/perf/util/sort.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,17 @@ static int __setup_sorting(void)
13581358
return ret;
13591359
}
13601360

1361+
bool perf_hpp__should_skip(struct perf_hpp_fmt *format)
1362+
{
1363+
if (perf_hpp__is_sort_entry(format)) {
1364+
struct hpp_sort_entry *hse;
1365+
1366+
hse = container_of(format, struct hpp_sort_entry, hpp);
1367+
return hse->se->elide;
1368+
}
1369+
return false;
1370+
}
1371+
13611372
static void sort_entry__setup_elide(struct sort_entry *se,
13621373
struct strlist *list,
13631374
const char *list_name, FILE *fp)

0 commit comments

Comments
 (0)