diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-03-17 15:59:21 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-03-18 17:16:57 -0400 |
commit | b3cef7f60f17d953545f7069f6407fc24202a64d (patch) | |
tree | 1abd97c0abd8a0c79af0fd1e7515f8b0e699abbe /tools | |
parent | 80790e0b7ef768b6591fdf764b62c572b76a5d80 (diff) |
perf symbols: Record the reason for filtering an address_location
By turning the addr_location->filtered member from a boolean to a u8
bitmap, reusing (and extending) the hist_filter enum for that.
This patch doesn't change the logic at all, as it keeps the meaning of
al->filtered !0 to mean that the entry _was_ filtered, so no change in
how this value is interpreted needs to be done at this point.
This will be soon used in upcoming patches.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-89hmfgtr9t22sky1lyg7nw7l@git.kernel.org
[ yanked this out of a previous patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-timechart.c | 2 | ||||
-rw-r--r-- | tools/perf/util/event.c | 20 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 7 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 9 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 2 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 2 |
6 files changed, 25 insertions, 17 deletions
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index d4991a235155..74db2568b867 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -494,7 +494,7 @@ static const char *cat_backtrace(union perf_event *event, | |||
494 | continue; | 494 | continue; |
495 | } | 495 | } |
496 | 496 | ||
497 | tal.filtered = false; | 497 | tal.filtered = 0; |
498 | thread__find_addr_location(al.thread, machine, cpumode, | 498 | thread__find_addr_location(al.thread, machine, cpumode, |
499 | MAP__FUNCTION, ip, &tal); | 499 | MAP__FUNCTION, ip, &tal); |
500 | 500 | ||
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 3e580be0f6fb..0da09db5f9f6 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/types.h> | 1 | #include <linux/types.h> |
2 | #include "event.h" | 2 | #include "event.h" |
3 | #include "debug.h" | 3 | #include "debug.h" |
4 | #include "hist.h" | ||
4 | #include "machine.h" | 5 | #include "machine.h" |
5 | #include "sort.h" | 6 | #include "sort.h" |
6 | #include "string.h" | 7 | #include "string.h" |
@@ -705,7 +706,7 @@ void thread__find_addr_map(struct thread *thread, | |||
705 | al->thread = thread; | 706 | al->thread = thread; |
706 | al->addr = addr; | 707 | al->addr = addr; |
707 | al->cpumode = cpumode; | 708 | al->cpumode = cpumode; |
708 | al->filtered = false; | 709 | al->filtered = 0; |
709 | 710 | ||
710 | if (machine == NULL) { | 711 | if (machine == NULL) { |
711 | al->map = NULL; | 712 | al->map = NULL; |
@@ -731,11 +732,11 @@ void thread__find_addr_map(struct thread *thread, | |||
731 | if ((cpumode == PERF_RECORD_MISC_GUEST_USER || | 732 | if ((cpumode == PERF_RECORD_MISC_GUEST_USER || |
732 | cpumode == PERF_RECORD_MISC_GUEST_KERNEL) && | 733 | cpumode == PERF_RECORD_MISC_GUEST_KERNEL) && |
733 | !perf_guest) | 734 | !perf_guest) |
734 | al->filtered = true; | 735 | al->filtered |= (1 << HIST_FILTER__GUEST); |
735 | if ((cpumode == PERF_RECORD_MISC_USER || | 736 | if ((cpumode == PERF_RECORD_MISC_USER || |
736 | cpumode == PERF_RECORD_MISC_KERNEL) && | 737 | cpumode == PERF_RECORD_MISC_KERNEL) && |
737 | !perf_host) | 738 | !perf_host) |
738 | al->filtered = true; | 739 | al->filtered |= (1 << HIST_FILTER__HOST); |
739 | 740 | ||
740 | return; | 741 | return; |
741 | } | 742 | } |
@@ -792,8 +793,10 @@ int perf_event__preprocess_sample(const union perf_event *event, | |||
792 | if (thread == NULL) | 793 | if (thread == NULL) |
793 | return -1; | 794 | return -1; |
794 | 795 | ||
795 | if (thread__is_filtered(thread)) | 796 | if (thread__is_filtered(thread)) { |
797 | al->filtered |= (1 << HIST_FILTER__THREAD); | ||
796 | goto out_filtered; | 798 | goto out_filtered; |
799 | } | ||
797 | 800 | ||
798 | dump_printf(" ... thread: %s:%d\n", thread__comm_str(thread), thread->tid); | 801 | dump_printf(" ... thread: %s:%d\n", thread__comm_str(thread), thread->tid); |
799 | /* | 802 | /* |
@@ -823,8 +826,10 @@ int perf_event__preprocess_sample(const union perf_event *event, | |||
823 | dso->short_name) || | 826 | dso->short_name) || |
824 | (dso->short_name != dso->long_name && | 827 | (dso->short_name != dso->long_name && |
825 | strlist__has_entry(symbol_conf.dso_list, | 828 | strlist__has_entry(symbol_conf.dso_list, |
826 | dso->long_name))))) | 829 | dso->long_name))))) { |
830 | al->filtered |= (1 << HIST_FILTER__DSO); | ||
827 | goto out_filtered; | 831 | goto out_filtered; |
832 | } | ||
828 | 833 | ||
829 | al->sym = map__find_symbol(al->map, al->addr, | 834 | al->sym = map__find_symbol(al->map, al->addr, |
830 | machine->symbol_filter); | 835 | machine->symbol_filter); |
@@ -832,12 +837,13 @@ int perf_event__preprocess_sample(const union perf_event *event, | |||
832 | 837 | ||
833 | if (symbol_conf.sym_list && | 838 | if (symbol_conf.sym_list && |
834 | (!al->sym || !strlist__has_entry(symbol_conf.sym_list, | 839 | (!al->sym || !strlist__has_entry(symbol_conf.sym_list, |
835 | al->sym->name))) | 840 | al->sym->name))) { |
841 | al->filtered |= (1 << HIST_FILTER__SYMBOL); | ||
836 | goto out_filtered; | 842 | goto out_filtered; |
843 | } | ||
837 | 844 | ||
838 | return 0; | 845 | return 0; |
839 | 846 | ||
840 | out_filtered: | 847 | out_filtered: |
841 | al->filtered = true; | ||
842 | return 0; | 848 | return 0; |
843 | } | 849 | } |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 0466efa71140..9507f33b02ff 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -13,13 +13,6 @@ static bool hists__filter_entry_by_thread(struct hists *hists, | |||
13 | static bool hists__filter_entry_by_symbol(struct hists *hists, | 13 | static bool hists__filter_entry_by_symbol(struct hists *hists, |
14 | struct hist_entry *he); | 14 | struct hist_entry *he); |
15 | 15 | ||
16 | enum hist_filter { | ||
17 | HIST_FILTER__DSO, | ||
18 | HIST_FILTER__THREAD, | ||
19 | HIST_FILTER__PARENT, | ||
20 | HIST_FILTER__SYMBOL, | ||
21 | }; | ||
22 | |||
23 | struct callchain_param callchain_param = { | 16 | struct callchain_param callchain_param = { |
24 | .mode = CHAIN_GRAPH_REL, | 17 | .mode = CHAIN_GRAPH_REL, |
25 | .min_percent = 0.5, | 18 | .min_percent = 0.5, |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 0c76bf972736..1f1f513dfe7f 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -14,6 +14,15 @@ struct hist_entry; | |||
14 | struct addr_location; | 14 | struct addr_location; |
15 | struct symbol; | 15 | struct symbol; |
16 | 16 | ||
17 | enum hist_filter { | ||
18 | HIST_FILTER__DSO, | ||
19 | HIST_FILTER__THREAD, | ||
20 | HIST_FILTER__PARENT, | ||
21 | HIST_FILTER__SYMBOL, | ||
22 | HIST_FILTER__GUEST, | ||
23 | HIST_FILTER__HOST, | ||
24 | }; | ||
25 | |||
17 | /* | 26 | /* |
18 | * The kernel collects the number of events it couldn't send in a stretch and | 27 | * The kernel collects the number of events it couldn't send in a stretch and |
19 | * when possible sends this number in a PERF_RECORD_LOST event. The number of | 28 | * when possible sends this number in a PERF_RECORD_LOST event. The number of |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 5cecd98c1bc0..d280bf210183 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1312,7 +1312,7 @@ static int machine__resolve_callchain_sample(struct machine *machine, | |||
1312 | continue; | 1312 | continue; |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | al.filtered = false; | 1315 | al.filtered = 0; |
1316 | thread__find_addr_location(thread, machine, cpumode, | 1316 | thread__find_addr_location(thread, machine, cpumode, |
1317 | MAP__FUNCTION, ip, &al); | 1317 | MAP__FUNCTION, ip, &al); |
1318 | if (al.sym != NULL) { | 1318 | if (al.sym != NULL) { |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 2553ae04b788..501e4e722e8e 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -186,7 +186,7 @@ struct addr_location { | |||
186 | struct symbol *sym; | 186 | struct symbol *sym; |
187 | u64 addr; | 187 | u64 addr; |
188 | char level; | 188 | char level; |
189 | bool filtered; | 189 | u8 filtered; |
190 | u8 cpumode; | 190 | u8 cpumode; |
191 | s32 cpu; | 191 | s32 cpu; |
192 | }; | 192 | }; |