Perf lock improvements
v2 cover Perf lock improvements
Improvement to command line handling for perf lock info.
---
v1: https://lore.kernel.org/all/[email protected]/
v2:
* Drop previous "perf lock report: Restore aggregation by caller by default" patch. Not required for newly collected data with LOCKDEP tracepoints.
* Display map and thread info (rather than an error) when neither or both of --map and --thread are specified.
Nick Forrington (1):
perf lock info: Display both map and thread by default
tools/perf/Documentation/perf-lock.txt | 4 ++-- tools/perf/builtin-lock.c | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-)
Signature · 1 line
2.44.0
PATCH v2 1/1 perf lock info: Display both map and thread by default
Change "perf lock info" argument handling to:
Display both map and thread info (rather than an error) when neither are specified.
Display both map and thread info (rather than just thread info) when both are requested.
--- tools/perf/Documentation/perf-lock.txt | 4 ++-- tools/perf/builtin-lock.c | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-)
tools/perf/Documentation/perf-lock.txt +2 -2
@@ -111,11 +111,11 @@ INFO OPTIONS -t:: --threads:: - dump thread list in perf.data + dump only the thread list in perf.data -m:: --map:: - dump map of lock instances (address:name table) + dump only the map of lock instances (address:name table) CONTENTION OPTIONS
tools/perf/builtin-lock.c +17 -5
@@ -1483,11 +1483,16 @@ static int dump_info(void)if (info_threads)dump_threads (); -else if (info_map) + +if (info_map) { +if (info_threads) +fputc ('\n' , lock_output);dump_map (); -else { + } + +if (!info_threads && !info_map) { rc =-1 ; -pr_err ("Unknown type of information\n" ); +pr_err ("No lock info specified\n" ); }return rc;
@@ -2578,9 +2583,9 @@ int cmd_lock(int argc, const char **argv)const struct option info_options[] = {OPT_BOOLEAN ('t' ,"threads" , &info_threads, -"dump thread list in perf.data" ), +"dump only the thread list in perf.data" ),OPT_BOOLEAN ('m' ,"map" , &info_map, -"map of lock instances (address:name table)" ), +"dump only the map of lock instances (address:name table)" ),OPT_PARENT (lock_options) };
@@ -2694,6 +2699,13 @@ int cmd_lock(int argc, const char **argv)if (argc)usage_with_options (info_usage, info_options); } + +/* If neither threads nor map requested, display both */ +if (!info_threads && !info_map) { + info_threads = true; + info_map = true; + } +/* recycling report_lock_ops */ trace_handler = &report_lock_ops; rc =__cmd_report (true);
Signature · 1 line
2.44.0
Namhyung Kim
maintainerRe: [PATCH v2 1/1] perf lock info: Display both map and thread by default
Hello,
Quoted 20 lines · Nick Forrington
Change "perf lock info" argument handling to:
Display both map and thread info (rather than an error) when neither are specified.
Display both map and thread info (rather than just thread info) when both are requested.
Signed-off-by Nick Forrington <[email protected]>--- tools/perf/Documentation/perf-lock.txt | 4 ++-- tools/perf/builtin-lock.c | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-)tools/perf/Documentation/perf-lock.txt +0
-0
tools/perf/Documentation/perf-lock.txt INFO OPTIONS · line 118
Quoted 10 lines
tools/perf/Documentation/perf-lock.txt +2
-2@@ -111,11 +111,11 @@ INFO OPTIONS -t:: --threads:: - dump thread list in perf.data + dump only the thread list in perf.data -m:: --map:: - dump map of lock instances (address:name table) + dump only the map of lock instances (address:name table)
But your change allows both thread and map info to be printed, right?
Quoted 15 lines
tools/perf/Documentation/perf-lock.txt +0
-0CONTENTION OPTIONStools/perf/builtin-lock.c +3
-1@@ -1483,11 +1483,16 @@ static int dump_info(void)if (info_threads)dump_threads (); -else if (info_map) + +if (info_map) { +if (info_threads)
tools/perf/builtin-lock.c static int dump_info(void) · line 1496
Quoted 10 lines
tools/perf/builtin-lock.c +5
-2+fputc ('\n' , lock_output);dump_map (); - else { + } + +if (!info_threads && !info_map) { rc =-1 ; -pr_err ("Unknown type of information\n" ); +pr_err ("No lock info specified\n" ); }
I guess you made this condition impossible.
tools/perf/builtin-lock.c int cmd_lock(int argc, const char **argv) · line 2588
Quoted 11 lines
tools/perf/builtin-lock.c +2
-2return rc;@@ -2578,9 +2583,9 @@ int cmd_lock(int argc, const char **argv)const struct option info_options[] = {OPT_BOOLEAN ('t' ,"threads" , &info_threads, -"dump thread list in perf.data" ), +"dump only the thread list in perf.data" ),OPT_BOOLEAN ('m' ,"map" , &info_map, -"map of lock instances (address:name table)" ), +"dump only the map of lock instances (address:name table)" ),
Ditto, I think we can drop the 'only' part.
Thanks,
Namhyung
Quoted 21 lines
tools/perf/builtin-lock.c +7
-1OPT_PARENT(lock_options) };@@ -2694,6 +2699,13 @@ int cmd_lock(int argc, const char **argv)if (argc)usage_with_options (info_usage, info_options); } + +/* If neither threads nor map requested, display both */ +if (!info_threads && !info_map) { + info_threads = true; + info_map = true; + } +/* recycling report_lock_ops */ trace_handler = &report_lock_ops; rc =__cmd_report (true); --2.44.0
Re: [PATCH v2 1/1] perf lock info: Display both map and thread by default
Quoted 28 lines · Namhyung Kim
Hello,
Quoted 25 lines · Nick Forrington
Change "perf lock info" argument handling to:
Display both map and thread info (rather than an error) when neither are specified.
Display both map and thread info (rather than just thread info) when both are requested.
Signed-off-by Nick Forrington<[email protected]>--- tools/perf/Documentation/perf-lock.txt | 4 ++-- tools/perf/builtin-lock.c | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-)tools/perf/Documentation/perf-lock.txt +1
-1@@ -111,11 +111,11 @@ INFO OPTIONS -t:: --threads:: - dump thread list in perf.data + dump only the thread list in perf.data
Quoted 5 lines
tools/perf/Documentation/perf-lock.txt INFO OPTIONS · line 118
Quoted 4 lines
tools/perf/Documentation/perf-lock.txt +1
-1-m:: --map:: - dump map of lock instances (address:name table) + dump only the map of lock instances (address:name table)But your change allows both thread and map info to be printed, right?
Yes
Quoted 16 lines
Quoted 16 lines
tools/perf/Documentation/perf-lock.txt +0
-0CONTENTION OPTIONStools/perf/builtin-lock.c +4
-2@@ -1483,11 +1483,16 @@ static int dump_info(void)if (info_threads)dump_threads (); -else if (info_map) + +if (info_map) { +if (info_threads) +fputc ('\n' , lock_output);dump_map (); -else {
Quoted 8 lines
tools/perf/builtin-lock.c static int dump_info(void) · line 1496
Quoted 7 lines
tools/perf/builtin-lock.c +4
-1+ } + +if (!info_threads && !info_map) { rc =-1 ; -pr_err ("Unknown type of information\n" ); +pr_err ("No lock info specified\n" ); }I guess you made this condition impossible.
Yes. (I kept/updated the error handling for potential future errors)
Quoted 11 lines
tools/perf/builtin-lock.c int cmd_lock(int argc, const char **argv) · line 2588
Quoted 10 lines
tools/perf/builtin-lock.c +2
-2return rc;@@ -2578,9 +2583,9 @@ int cmd_lock(int argc, const char **argv)const struct option info_options[] = {OPT_BOOLEAN ('t' ,"threads" , &info_threads, -"dump thread list in perf.data" ), +"dump only the thread list in perf.data" ),OPT_BOOLEAN ('m' ,"map" , &info_map, -"map of lock instances (address:name table)" ), +"dump only the map of lock instances (address:name table)" ),Ditto, I think we can drop the 'only' part.
Ok, I'll submit a new version with this removed
Quoted 25 lines
Thanks,
NamhyungQuoted 21 lines
tools/perf/builtin-lock.c +7
-1OPT_PARENT(lock_options) };@@ -2694,6 +2699,13 @@ int cmd_lock(int argc, const char **argv)if (argc)usage_with_options (info_usage, info_options); } + +/* If neither threads nor map requested, display both */ +if (!info_threads && !info_map) { + info_threads = true; + info_map = true; + } +/* recycling report_lock_ops */ trace_handler = &report_lock_ops; rc =__cmd_report (true); --2.44.0