[PATCH v2 05/10] tools, perf, script: Set user_set/wildcard_set for +- fields in -F
From: Andi Kleen
Date: Fri Aug 31 2018 - 18:02:24 EST
From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
The branch target output relies on the user_set flag to determine
if the branch target should be implicitely printed. When
modifying the fields with + or - also set user_set,
so that ADDR can be removed. We also need to set wildcard_set
to make the initial sanity check pass.
Before:
% perf script --itrace=cr -F +callindent,-ip,-sym,-symoff,-addr
swapper 0 [000] 3377.917072: 1 branches: pt_config => ffffffff81010486 ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: pt_config => ffffffff8101063e ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: pt_event_add => ffffffff8115e687 ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: perf_pmu_enable => ffffffff811579b0 ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: perf_pmu_nop_void => ffffffff8115e72b ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: event_sched_in.isra.107 => ffffffff8115e7a5 ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: __x86_indirect_thunk_rax => ffffffff81a03000 ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: perf_pmu_nop_int => ffffffff8115e7fb ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: group_sched_in => ffffffff811583a8 ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: event_filter_match => ffffffff81153e10 ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: event_filter_match => ffffffff811583d4 ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: group_sched_in => ffffffff8115e738 ([kernel.kallsyms])
swapper 0 [000] 3377.917072: 1 branches: __x86_indirect_thunk_rax => ffffffff81a03000 ([kernel.kallsyms])
After:
% perf script --itrace=cr -F +callindent,-ip,-sym,-symoff,-addr
swapper 0 [000] 3377.917072: 1 branches: pt_config
swapper 0 [000] 3377.917072: 1 branches: pt_config
swapper 0 [000] 3377.917072: 1 branches: pt_event_add
swapper 0 [000] 3377.917072: 1 branches: perf_pmu_enable
swapper 0 [000] 3377.917072: 1 branches: perf_pmu_nop_void
swapper 0 [000] 3377.917072: 1 branches: event_sched_in.isra.107
swapper 0 [000] 3377.917072: 1 branches: __x86_indirect_thunk_rax
swapper 0 [000] 3377.917072: 1 branches: perf_pmu_nop_int
swapper 0 [000] 3377.917072: 1 branches: group_sched_in
swapper 0 [000] 3377.917072: 1 branches: event_filter_match
swapper 0 [000] 3377.917072: 1 branches: event_filter_match
swapper 0 [000] 3377.917072: 1 branches: group_sched_in
v2: Use correct index for fallback case
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
tools/perf/builtin-script.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index bae960c56763..d7d454d10074 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2490,6 +2490,8 @@ static int parse_output_fields(const struct option *opt __maybe_unused,
output[j].fields &= ~all_output_options[i].field;
else
output[j].fields |= all_output_options[i].field;
+ output[j].user_set = true;
+ output[j].wildcard_set = true;
}
}
} else {
@@ -2500,7 +2502,8 @@ static int parse_output_fields(const struct option *opt __maybe_unused,
rc = -EINVAL;
goto out;
}
- output[type].fields |= all_output_options[i].field;
+ output[type].user_set = true;
+ output[type].wildcard_set = true;
}
}
--
2.17.1