Re: [PATCH v5 5/5] perf lock: Update documentation for -o option in contention mode
From: Namhyung Kim
Date: Thu Feb 13 2025 - 18:28:27 EST
On Wed, Feb 12, 2025 at 02:24:56PM -0800, Chun-Tse Shao wrote:
> This patch also decouple -o with -t, and shows warning to notify the new
> behavior for -ov.
I think it's better to squash this commit to the previous.
>
> Signed-off-by: Chun-Tse Shao <ctshao@xxxxxxxxxx>
> ---
> tools/perf/builtin-lock.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
> index 3dc100cf30ef..e16bda6ce525 100644
> --- a/tools/perf/builtin-lock.c
> +++ b/tools/perf/builtin-lock.c
> @@ -1817,7 +1817,7 @@ static void print_contention_result(struct lock_contention *con)
> break;
> }
>
> - if (con->owner && con->save_callstack) {
> + if (con->owner && con->save_callstack && verbose > 0) {
> struct rb_root root = RB_ROOT;
>
> if (symbol_conf.field_sep)
> @@ -1978,6 +1978,11 @@ static int check_lock_contention_options(const struct option *options,
> }
> }
>
> + if (show_lock_owner && !show_thread_stats) {
> + pr_warning("Now -o try to show owner's callstack instead of pid and comm.\n");
> + pr_warning("Please use -t option too to keep the old behavior.\n");
> + }
> +
> return 0;
> }
>
> @@ -2569,7 +2574,8 @@ int cmd_lock(int argc, const char **argv)
> "Filter specific address/symbol of locks", parse_lock_addr),
> OPT_CALLBACK('S', "callstack-filter", NULL, "NAMES",
> "Filter specific function in the callstack", parse_call_stack),
> - OPT_BOOLEAN('o', "lock-owner", &show_lock_owner, "show lock owners instead of waiters"),
> + OPT_BOOLEAN('o', "lock-owner", &show_lock_owner, "show lock owners instead of waiters.\n"
> + "\t\t\tThis option can be combined with -t, which shows owner's per thread lock stats, or -v, which shows owner's stacktrace"),
I think this description should go to the man page and leave the option
as is. You made it to show the warning when it's actually used.
Thanks,
Namhyung
> OPT_STRING_NOEMPTY('x', "field-separator", &symbol_conf.field_sep, "separator",
> "print result in CSV format with custom separator"),
> OPT_BOOLEAN(0, "lock-cgroup", &show_lock_cgroups, "show lock stats by cgroup"),
> --
> 2.48.1.502.g6dc24dfdaf-goog
>