diff options
author | Namhyung Kim <namhyung@kernel.org> | 2024-06-07 13:29:17 -0700 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2024-06-15 21:04:04 -0700 |
commit | 411ee13598ef322c1a7f4a4022a84d995873f235 (patch) | |
tree | c6396fe88e9e6036cd00760dc406429b2572ab80 /tools/perf/util | |
parent | 8f6071a3dce40e6991877873699b84c4fb570ab3 (diff) |
perf hist: Add symbol_conf.skip_empty
Add the skip_empty flag to symbol_conf and set the value from the report
command to preserve the existing behavior. This makes the code simpler
and will be needed other code which is hard to add a new argument.
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240607202918.2357459-4-namhyung@kernel.org
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/events_stats.h | 3 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 6 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 3 | ||||
-rw-r--r-- | tools/perf/util/session.c | 5 | ||||
-rw-r--r-- | tools/perf/util/session.h | 3 | ||||
-rw-r--r-- | tools/perf/util/symbol_conf.h | 3 |
6 files changed, 10 insertions, 13 deletions
diff --git a/tools/perf/util/events_stats.h b/tools/perf/util/events_stats.h index 8fecc9fbaecc..f43e5b1a366a 100644 --- a/tools/perf/util/events_stats.h +++ b/tools/perf/util/events_stats.h @@ -52,7 +52,6 @@ struct hists_stats { void events_stats__inc(struct events_stats *stats, u32 type); -size_t events_stats__fprintf(struct events_stats *stats, FILE *fp, - bool skip_empty); +size_t events_stats__fprintf(struct events_stats *stats, FILE *fp); #endif /* __PERF_EVENTS_STATS_ */ diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 2e9e193179dd..f028f113c4fd 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -2706,8 +2706,7 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al, } } -size_t evlist__fprintf_nr_events(struct evlist *evlist, FILE *fp, - bool skip_empty) +size_t evlist__fprintf_nr_events(struct evlist *evlist, FILE *fp) { struct evsel *pos; size_t ret = 0; @@ -2715,7 +2714,8 @@ size_t evlist__fprintf_nr_events(struct evlist *evlist, FILE *fp, evlist__for_each_entry(evlist, pos) { struct hists *hists = evsel__hists(pos); - if (skip_empty && !hists->stats.nr_samples && !hists->stats.nr_lost_samples) + if (symbol_conf.skip_empty && !hists->stats.nr_samples && + !hists->stats.nr_lost_samples) continue; ret += fprintf(fp, "%s stats:\n", evsel__name(pos)); diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 8fb3bdd29188..5273f5c37050 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@ -375,8 +375,7 @@ void hists__inc_nr_lost_samples(struct hists *hists, u32 lost); size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, int max_cols, float min_pcnt, FILE *fp, bool ignore_callchains); -size_t evlist__fprintf_nr_events(struct evlist *evlist, FILE *fp, - bool skip_empty); +size_t evlist__fprintf_nr_events(struct evlist *evlist, FILE *fp); void hists__filter_by_dso(struct hists *hists); void hists__filter_by_thread(struct hists *hists); diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index a10343b9dcd4..0ec92d47373c 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2696,8 +2696,7 @@ size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp return machines__fprintf_dsos_buildid(&session->machines, fp, skip, parm); } -size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp, - bool skip_empty) +size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp) { size_t ret; const char *msg = ""; @@ -2707,7 +2706,7 @@ size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp, ret = fprintf(fp, "\nAggregated stats:%s\n", msg); - ret += events_stats__fprintf(&session->evlist->stats, fp, skip_empty); + ret += events_stats__fprintf(&session->evlist->stats, fp); return ret; } diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 3b0256e977a6..4c29dc86956f 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h @@ -130,8 +130,7 @@ size_t perf_session__fprintf_dsos(struct perf_session *session, FILE *fp); size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp, bool (fn)(struct dso *dso, int parm), int parm); -size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp, - bool skip_empty); +size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp); void perf_session__dump_kmaps(struct perf_session *session); diff --git a/tools/perf/util/symbol_conf.h b/tools/perf/util/symbol_conf.h index c114bbceef40..657cfa5af43c 100644 --- a/tools/perf/util/symbol_conf.h +++ b/tools/perf/util/symbol_conf.h @@ -46,7 +46,8 @@ struct symbol_conf { lazy_load_kernel_maps, keep_exited_threads, annotate_data_member, - annotate_data_sample; + annotate_data_sample, + skip_empty; const char *vmlinux_name, *kallsyms_name, *source_prefix, |