perf report: Switch filtered from u8 to u16
authorDmitry Vyukov <dvyukov@google.com>
Thu, 13 Feb 2025 09:08:16 +0000 (10:08 +0100)
committerNamhyung Kim <namhyung@kernel.org>
Tue, 18 Feb 2025 22:04:31 +0000 (14:04 -0800)
We already have all u8 bits taken, adding one more filter leads to unpleasant
failure mode, where code compiles w/o warnings, but the last filters silently
don't work. Add a typedef and switch to u16.

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Link: https://lore.kernel.org/r/32b4ce1731126c88a2d9e191dc87e39ae4651cb7.1739437531.git.dvyukov@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/addr_location.h
tools/perf/util/hist.c
tools/perf/util/hist.h

index 36aaa45445f24cbf000ce7a1176f2dc9ae4483a0..5cc1ba6c05237f265cac9c09762160d68d0c9cf2 100644 (file)
@@ -17,8 +17,8 @@ struct addr_location {
        const char    *srcline;
        u64           addr;
        char          level;
-       u8            filtered;
        u8            cpumode;
+       u16           filtered;
        s32           cpu;
        s32           socket;
        /* Same as machine.parallelism but within [1, nr_cpus]. */
index cafd693568189eb97b0f0cbca306a7602079190e..6b8f8da8d3b66223f4c13172ac7074d7b5a9fdfa 100644 (file)
@@ -585,7 +585,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template,
        return he;
 }
 
-static u8 symbol__parent_filter(const struct symbol *parent)
+static filter_mask_t symbol__parent_filter(const struct symbol *parent)
 {
        if (symbol_conf.exclude_other && parent == NULL)
                return 1 << HIST_FILTER__PARENT;
index a6e662d77dc2456124b28d98a6b437394e1a5ef6..4035106a74087356e35b2f9f1b02e2939c6629f9 100644 (file)
@@ -33,6 +33,8 @@ enum hist_filter {
        HIST_FILTER__C2C,
 };
 
+typedef u16 filter_mask_t;
+
 enum hist_column {
        HISTC_SYMBOL,
        HISTC_TIME,
@@ -244,7 +246,7 @@ struct hist_entry {
        bool                    leaf;
 
        char                    level;
-       u8                      filtered;
+       filter_mask_t           filtered;
 
        u16                     callchain_size;
        union {