aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/hist.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r--tools/perf/util/hist.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 8380c3db1c92..2c624ad371a7 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -10,11 +10,14 @@ static bool hists__filter_entry_by_dso(struct hists *hists,
10 struct hist_entry *he); 10 struct hist_entry *he);
11static bool hists__filter_entry_by_thread(struct hists *hists, 11static bool hists__filter_entry_by_thread(struct hists *hists,
12 struct hist_entry *he); 12 struct hist_entry *he);
13static bool hists__filter_entry_by_symbol(struct hists *hists,
14 struct hist_entry *he);
13 15
14enum hist_filter { 16enum hist_filter {
15 HIST_FILTER__DSO, 17 HIST_FILTER__DSO,
16 HIST_FILTER__THREAD, 18 HIST_FILTER__THREAD,
17 HIST_FILTER__PARENT, 19 HIST_FILTER__PARENT,
20 HIST_FILTER__SYMBOL,
18}; 21};
19 22
20struct callchain_param callchain_param = { 23struct callchain_param callchain_param = {
@@ -420,6 +423,7 @@ static void hists__apply_filters(struct hists *hists, struct hist_entry *he)
420{ 423{
421 hists__filter_entry_by_dso(hists, he); 424 hists__filter_entry_by_dso(hists, he);
422 hists__filter_entry_by_thread(hists, he); 425 hists__filter_entry_by_thread(hists, he);
426 hists__filter_entry_by_symbol(hists, he);
423} 427}
424 428
425static void __hists__collapse_resort(struct hists *hists, bool threaded) 429static void __hists__collapse_resort(struct hists *hists, bool threaded)
@@ -1247,6 +1251,37 @@ void hists__filter_by_thread(struct hists *hists)
1247 } 1251 }
1248} 1252}
1249 1253
1254static bool hists__filter_entry_by_symbol(struct hists *hists,
1255 struct hist_entry *he)
1256{
1257 if (hists->symbol_filter_str != NULL &&
1258 (!he->ms.sym || strstr(he->ms.sym->name,
1259 hists->symbol_filter_str) == NULL)) {
1260 he->filtered |= (1 << HIST_FILTER__SYMBOL);
1261 return true;
1262 }
1263
1264 return false;
1265}
1266
1267void hists__filter_by_symbol(struct hists *hists)
1268{
1269 struct rb_node *nd;
1270
1271 hists->nr_entries = hists->stats.total_period = 0;
1272 hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
1273 hists__reset_col_len(hists);
1274
1275 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
1276 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
1277
1278 if (hists__filter_entry_by_symbol(hists, h))
1279 continue;
1280
1281 hists__remove_entry_filter(hists, h, HIST_FILTER__SYMBOL);
1282 }
1283}
1284
1250int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 ip) 1285int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 ip)
1251{ 1286{
1252 return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip); 1287 return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip);