Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
b3cef7f6 80790e0b

+25 -17
+1 -1
tools/perf/builtin-timechart.c
··· 494 494 continue; 495 495 } 496 496 497 - tal.filtered = false; 497 + tal.filtered = 0; 498 498 thread__find_addr_location(al.thread, machine, cpumode, 499 499 MAP__FUNCTION, ip, &tal); 500 500
+13 -7
tools/perf/util/event.c
··· 1 1 #include <linux/types.h> 2 2 #include "event.h" 3 3 #include "debug.h" 4 + #include "hist.h" 4 5 #include "machine.h" 5 6 #include "sort.h" 6 7 #include "string.h" ··· 706 705 al->thread = thread; 707 706 al->addr = addr; 708 707 al->cpumode = cpumode; 709 - al->filtered = false; 708 + al->filtered = 0; 710 709 711 710 if (machine == NULL) { 712 711 al->map = NULL; ··· 732 731 if ((cpumode == PERF_RECORD_MISC_GUEST_USER || 733 732 cpumode == PERF_RECORD_MISC_GUEST_KERNEL) && 734 733 !perf_guest) 735 - al->filtered = true; 734 + al->filtered |= (1 << HIST_FILTER__GUEST); 736 735 if ((cpumode == PERF_RECORD_MISC_USER || 737 736 cpumode == PERF_RECORD_MISC_KERNEL) && 738 737 !perf_host) 739 - al->filtered = true; 738 + al->filtered |= (1 << HIST_FILTER__HOST); 740 739 741 740 return; 742 741 } ··· 793 792 if (thread == NULL) 794 793 return -1; 795 794 796 - if (thread__is_filtered(thread)) 795 + if (thread__is_filtered(thread)) { 796 + al->filtered |= (1 << HIST_FILTER__THREAD); 797 797 goto out_filtered; 798 + } 798 799 799 800 dump_printf(" ... thread: %s:%d\n", thread__comm_str(thread), thread->tid); 800 801 /* ··· 826 823 dso->short_name) || 827 824 (dso->short_name != dso->long_name && 828 825 strlist__has_entry(symbol_conf.dso_list, 829 - dso->long_name))))) 826 + dso->long_name))))) { 827 + al->filtered |= (1 << HIST_FILTER__DSO); 830 828 goto out_filtered; 829 + } 831 830 832 831 al->sym = map__find_symbol(al->map, al->addr, 833 832 machine->symbol_filter); ··· 837 832 838 833 if (symbol_conf.sym_list && 839 834 (!al->sym || !strlist__has_entry(symbol_conf.sym_list, 840 - al->sym->name))) 835 + al->sym->name))) { 836 + al->filtered |= (1 << HIST_FILTER__SYMBOL); 841 837 goto out_filtered; 838 + } 842 839 843 840 return 0; 844 841 845 842 out_filtered: 846 - al->filtered = true; 847 843 return 0; 848 844 }
-7
tools/perf/util/hist.c
··· 13 13 static bool hists__filter_entry_by_symbol(struct hists *hists, 14 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 16 struct callchain_param callchain_param = { 24 17 .mode = CHAIN_GRAPH_REL, 25 18 .min_percent = 0.5,
+9
tools/perf/util/hist.h
··· 14 14 struct addr_location; 15 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 27 * The kernel collects the number of events it couldn't send in a stretch and 19 28 * when possible sends this number in a PERF_RECORD_LOST event. The number of
+1 -1
tools/perf/util/machine.c
··· 1312 1312 continue; 1313 1313 } 1314 1314 1315 - al.filtered = false; 1315 + al.filtered = 0; 1316 1316 thread__find_addr_location(thread, machine, cpumode, 1317 1317 MAP__FUNCTION, ip, &al); 1318 1318 if (al.sym != NULL) {
+1 -1
tools/perf/util/symbol.h
··· 186 186 struct symbol *sym; 187 187 u64 addr; 188 188 char level; 189 - bool filtered; 189 + u8 filtered; 190 190 u8 cpumode; 191 191 s32 cpu; 192 192 };