2024-04-18 13:13:37

by Changbin Du

[permalink] [raw]
Subject: [PATCH 3/4] perf trace beauty: Always show param if show_zero is set

For some parameters, it is best to also display them when they are 0,
e.g. flags.

Signed-off-by: Changbin Du <[email protected]>
---
tools/perf/builtin-trace.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 19e81a467d6a..349550b02f79 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2086,9 +2086,9 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
!trace->show_zeros &&
!(sc->arg_fmt &&
(sc->arg_fmt[arg.idx].show_zero ||
- sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAY ||
- sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAYS) &&
- sc->arg_fmt[arg.idx].parm))
+ ((sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAY ||
+ sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAYS) &&
+ sc->arg_fmt[arg.idx].parm))))
continue;

printed += scnprintf(bf + printed, size - printed, "%s", printed ? ", " : "");
@@ -2790,8 +2790,8 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel,
*/
if (val == 0 &&
!trace->show_zeros &&
- !((arg->show_zero ||
- arg->scnprintf == SCA_STRARRAY ||
+ !arg->show_zero &&
+ !((arg->scnprintf == SCA_STRARRAY ||
arg->scnprintf == SCA_STRARRAYS) &&
arg->parm))
continue;
--
2.34.1