diff options
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/hist.c | 35 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 2 |
2 files changed, 37 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); |
11 | static bool hists__filter_entry_by_thread(struct hists *hists, | 11 | static bool hists__filter_entry_by_thread(struct hists *hists, |
12 | struct hist_entry *he); | 12 | struct hist_entry *he); |
13 | static bool hists__filter_entry_by_symbol(struct hists *hists, | ||
14 | struct hist_entry *he); | ||
13 | 15 | ||
14 | enum hist_filter { | 16 | enum 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 | ||
20 | struct callchain_param callchain_param = { | 23 | struct 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 | ||
425 | static void __hists__collapse_resort(struct hists *hists, bool threaded) | 429 | static 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 | ||
1254 | static 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 | |||
1267 | void 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 | |||
1250 | int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 ip) | 1285 | int 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); |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 9413f3e31fea..10343c081e19 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -62,6 +62,7 @@ struct hists { | |||
62 | const struct thread *thread_filter; | 62 | const struct thread *thread_filter; |
63 | const struct dso *dso_filter; | 63 | const struct dso *dso_filter; |
64 | const char *uid_filter_str; | 64 | const char *uid_filter_str; |
65 | const char *symbol_filter_str; | ||
65 | pthread_mutex_t lock; | 66 | pthread_mutex_t lock; |
66 | struct events_stats stats; | 67 | struct events_stats stats; |
67 | u64 event_stream; | 68 | u64 event_stream; |
@@ -107,6 +108,7 @@ int hist_entry__annotate(struct hist_entry *self, size_t privsize); | |||
107 | 108 | ||
108 | void hists__filter_by_dso(struct hists *hists); | 109 | void hists__filter_by_dso(struct hists *hists); |
109 | void hists__filter_by_thread(struct hists *hists); | 110 | void hists__filter_by_thread(struct hists *hists); |
111 | void hists__filter_by_symbol(struct hists *hists); | ||
110 | 112 | ||
111 | u16 hists__col_len(struct hists *self, enum hist_column col); | 113 | u16 hists__col_len(struct hists *self, enum hist_column col); |
112 | void hists__set_col_len(struct hists *self, enum hist_column col, u16 len); | 114 | void hists__set_col_len(struct hists *self, enum hist_column col, u16 len); |