Add --verbose option to bunch of trace-cmd commands
cover Add --verbose option to bunch of trace-cmd commands
A new option to set log severity is added to these trace-cmd commands:
report, agent, check-events, listen. stack, dump, start, set, extract, stream, profile, record
These changes depend on "[PATCH 0/8] Changes to trace-cmd logs"
https://lore.kernel.org/linux-trace-devel/[email protected]/
Tzvetomir Stoyanov (VMware) (7):
trace-cmd report: Add --verbose
trace-cmd agent: Add --verbose
trace-cmd check-events: Add --verbose
trace-cmd: Add --verbose to bunch of trace-cmd commands trace-cmd listen: Add --verbose
trace-cmd stack: Add --verbose
trace-cmd dump: Add --verbose
.../trace-cmd/trace-cmd-check-events.1.txt | 9 +++++++++ Documentation/trace-cmd/trace-cmd-dump.1.txt | 8 ++++++++ Documentation/trace-cmd/trace-cmd-extract.1.txt | 8 ++++++++ Documentation/trace-cmd/trace-cmd-listen.1.txt | 8 ++++++++ Documentation/trace-cmd/trace-cmd-profile.1.txt | 9 +++++++++ Documentation/trace-cmd/trace-cmd-record.1.txt | 9 +++++++++ Documentation/trace-cmd/trace-cmd-report.1.txt | 9 +++++++++ Documentation/trace-cmd/trace-cmd-set.1.txt | 9 +++++++++ Documentation/trace-cmd/trace-cmd-stack.1.txt | 4 ++++ tracecmd/trace-agent.c | 6 ++++++ tracecmd/trace-check-events.c | 16 +++++++++++++++- tracecmd/trace-dump.c | 6 ++++++ tracecmd/trace-listen.c | 6 ++++++ tracecmd/trace-read.c | 6 ++++++ tracecmd/trace-record.c | 6 ++++++ tracecmd/trace-stack.c | 6 ++++++ tracecmd/trace-usage.c | 12 ++++++++++++ 17 files changed, 136 insertions(+), 1 deletion(-)
Signature · 1 line
2.30.2
PATCH 1/7 trace-cmd report: Add --verbose
Add new "trace-cmd report --verbose" argument for setting the desired log level.
--- Documentation/trace-cmd/trace-cmd-report.1.txt | 9 +++++++++ tracecmd/trace-read.c | 6 ++++++ tracecmd/trace-usage.c | 1 + 3 files changed, 16 insertions(+)
Documentation/trace-cmd/trace-cmd-report.1.txt +9 -0
@@ -312,6 +312,15 @@ OPTIONS *--raw-ts*:: Display raw timestamps, without any corrections. +*--verbose* 'level':: + Set the log level. Supported log levels are "none", "critical", "error", "warning", + "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log + level to specific value enables all logs from that and all previous levels. + + Example: enable all critical, error and warning logs + + trace-cmd report --verbose warning + EXAMPLES --------
tracecmd/trace-read.c +6 -0
@@ -1485,6 +1485,7 @@ static void add_hook(const char *arg) }enum { + OPT_verbose =235 , OPT_raw_ts =236 , OPT_version =237 , OPT_tscheck =238 ,
@@ -1578,6 +1579,7 @@ void trace_report (int argc, char **argv) {"ts-diff", no_argument, NULL, OPT_tsdiff}, {"ts-check", no_argument, NULL, OPT_tscheck}, {"raw-ts", no_argument, NULL, OPT_raw_ts}, + {"verbose", required_argument, NULL, OPT_verbose}, {"help", no_argument, NULL, '?'}, {NULL, 0, NULL, 0} };
@@ -1755,6 +1757,10 @@ void trace_report (int argc, char **argv)case OPT_raw_ts: raw_ts =1 ;break ; +case OPT_verbose: +if (trace_set_verbose (optarg) <0 ) +die ("invalid verbose level %s" , optarg); +break ;default :usage (argv); }
tracecmd/trace-usage.c +1 -0
@@ -234,6 +234,7 @@ static struct usage_help usage_help[] = {" --ts-diff Show the delta timestamp between events.\n" " --ts-check Check to make sure no time stamp on any CPU goes backwards.\n" " --raw-ts Display raw timestamps, without any corrections.\n" +" --verbose 'level' Set the desired log level\n" }, { "stream",
Signature · 1 line
2.30.2
PATCH 2/7 trace-cmd agent: Add --verbose
In reply to Tzvetomir Stoyanov (VMware)Add new "trace-cmd agent --verbose" argument for setting the desired log level.
--- tracecmd/trace-agent.c | 6 ++++++ tracecmd/trace-usage.c | 1 + 2 files changed, 7 insertions(+)
tracecmd/trace-agent.c +6 -0
@@ -281,6 +281,7 @@ busy: }enum { + OPT_verbose =254 ,DO_DEBUG =255 };
@@ -301,6 +302,7 @@ void trace_agent(int argc, char **argv) {"port", required_argument, NULL, 'p'}, {"help", no_argument, NULL, '?'}, {"debug", no_argument, NULL, DO_DEBUG}, + {"verbose", required_argument, NULL, OPT_verbose}, {NULL, 0, NULL, 0} };
@@ -321,6 +323,10 @@ void trace_agent(int argc, char **argv)case DO_DEBUG :tracecmd_set_debug (true);break ; +case OPT_verbose: +if (trace_set_verbose (optarg) <0 ) +die ("invalid verbose level %s" , optarg); +break ;default :usage (argv); }
tracecmd/trace-usage.c +1 -0
@@ -303,6 +303,7 @@ static struct usage_help usage_help[] = {" Creates a vsocket to listen for clients.\n" " -p port number to listen on.\n" " -D run in daemon mode.\n" +" --verbose 'level' Set the desired log level\n" }, { "setup-guest",
Signature · 1 line
2.30.2
PATCH 3/7 trace-cmd check-events: Add --verbose
In reply to Tzvetomir Stoyanov (VMware)Add new "trace-cmd check-events --verbose" argument for setting the desired log level.
--- .../trace-cmd/trace-cmd-check-events.1.txt | 9 +++++++++ tracecmd/trace-check-events.c | 16 +++++++++++++++- tracecmd/trace-usage.c | 1 + 3 files changed, 25 insertions(+), 1 deletion(-)
Documentation/trace-cmd/trace-cmd-check-events.1.txt +9 -0
@@ -24,6 +24,15 @@ OPTIONS ------- *-N* - Don't load plugins +*--verbose* 'level':: + Set the log level. Supported log levels are "none", "critical", "error", "warning", + "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log + level to specific value enables all logs from that and all previous levels. + + Example: enable all critical, error and warning logs + + trace-cmd check-events --verbose warning + SEE ALSO -------- trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-stop(1),
tracecmd/trace-check-events.c +15 -1
@@ -10,6 +10,10 @@#include "tracefs.h" #include "trace-local.h" +enum { + OPT_verbose =255 , +}; +void trace_check_events (int argc,char **argv) {const char *tracing;
@@ -18,8 +22,14 @@ void trace_check_events(int argc, char **argv)struct tep_handle *pevent =NULL ;struct tep_plugin_list *list =NULL ;int open_flags =0 ; +int option_index =0 ; +static struct option long_options[] = { + {"verbose" , required_argument,NULL , OPT_verbose}, + {NULL ,0 ,NULL ,0 } + }; + -while ((c =getopt (argc-1 , argv+1 ,"+hN" )) >=0 ) { +while ((c =getopt_long (argc-1 , argv+1 ,"+hN" , long_options, &option_index)) >=0 ) {switch (c) {case 'h' :default :
@@ -28,6 +38,10 @@ void trace_check_events(int argc, char **argv)case 'N' : open_flags |=TRACECMD_FL_LOAD_NO_PLUGINS ;break ; +case OPT_verbose: +if (trace_set_verbose (optarg) <0 ) +die ("invalid verbose level %s" , optarg); +break ; } } tracing =tracefs_tracing_dir ();
tracecmd/trace-usage.c +1 -0
@@ -363,6 +363,7 @@ static struct usage_help usage_help[] = {"parse trace event formats" ," %s check-events [-N]\n" " -N do not load any plugins\n" +" --verbose 'level' Set the desired log level\n" }, { "dump",
Signature · 1 line
2.30.2
PATCH 4/7 trace-cmd: Add --verbose to bunch of trace-cmd commands
In reply to Tzvetomir Stoyanov (VMware)Add new "--verbose" argument for setting the desired log level to these trace-cmd commands:
start
set
extract
stream
profile
record
--- Documentation/trace-cmd/trace-cmd-extract.1.txt | 8 ++++++++ Documentation/trace-cmd/trace-cmd-profile.1.txt | 9 +++++++++ Documentation/trace-cmd/trace-cmd-record.1.txt | 9 +++++++++ Documentation/trace-cmd/trace-cmd-set.1.txt | 9 +++++++++ tracecmd/trace-record.c | 6 ++++++ tracecmd/trace-usage.c | 6 ++++++ 6 files changed, 47 insertions(+)
Documentation/trace-cmd/trace-cmd-extract.1.txt +8 -0
@@ -67,6 +67,14 @@ OPTIONS this is the same as the default. But if *-B* or *-a* is used, this is required if the top level instance buffer should also be extracted. +*--verbose* 'level':: + Set the log level. Supported log levels are "none", "critical", "error", "warning", + "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log + level to specific value enables all logs from that and all previous levels. + + Example: enable all critical, error and warning logs + + trace-cmd extract --verbose warning SEE ALSO --------
Documentation/trace-cmd/trace-cmd-profile.1.txt +9 -0
@@ -90,6 +90,15 @@ These are the same as trace-cmd-record(1) with the *--profile* option. is not changed. This allows watching the command execute and saving the output of the profile to another file. +*--verbose* 'level':: + Set the log level. Supported log levels are "none", "critical", "error", "warning", + "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log + level to specific value enables all logs from that and all previous levels. + + Example: enable all critical, error and warning logs + + trace-cmd profile --verbose warning + EXAMPLES --------
Documentation/trace-cmd/trace-cmd-record.1.txt +9 -0
@@ -360,6 +360,15 @@ OPTIONS executed will not be changed. This is useful if you want to monitor the output of the command being executed, but not see the output from trace-cmd. +*--verbose* 'level':: + Set the log level. Supported log levels are "none", "critical", "error", "warning", + "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log + level to specific value enables all logs from that and all previous levels. + + Example: enable all critical, error and warning logs + + trace-cmd record --verbose warning + EXAMPLES --------
Documentation/trace-cmd/trace-cmd-set.1.txt +9 -0
@@ -227,6 +227,15 @@ OPTIONS unless the *--fork* option is specified. Then it will fork the command and return immediately. +*--verbose* 'level':: + Set the log level. Supported log levels are "none", "critical", "error", "warning", + "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log + level to specific value enables all logs from that and all previous levels. + + Example: enable all critical, error and warning logs + + trace-cmd set --verbose warning + EXAMPLES --------
tracecmd/trace-record.c +6 -0
@@ -5515,6 +5515,7 @@ void init_top_instance(void) }enum { + OPT_verbose =239 , OPT_tsc2nsec =240 , OPT_fork =241 , OPT_tsyncinterval =242 ,
@@ -5949,6 +5950,7 @@ static void parse_record_options(int argc, {"tsync-interval", required_argument, NULL, OPT_tsyncinterval}, {"fork", no_argument, NULL, OPT_fork}, {"tsc2nsec", no_argument, NULL, OPT_tsc2nsec}, + {"verbose", required_argument, NULL, OPT_verbose}, {NULL, 0, NULL, 0} };
@@ -6374,6 +6376,10 @@ static void parse_record_options(int argc,case 'q' : quiet = true;break ; +case OPT_verbose: +if (trace_set_verbose (optarg) <0 ) +die ("invalid verbose level %s" , optarg); +break ;default :usage (argv); }
tracecmd/trace-usage.c +6 -0
@@ -68,6 +68,7 @@ static struct usage_help usage_help[] = {" If a negative number is specified, timestamps synchronization is disabled" " If 0 is specified, no loop is performed - timestamps offset is calculated only twice," " at the beginnig and at the end of the trace\n" +" --verbose 'level' Set the desired log level\n" }, { "set",
@@ -104,6 +105,7 @@ static struct usage_help usage_help[] = {" --cmdlines-size change kernel saved_cmdlines_size\n" " --user execute the specified [command ...] as given user\n" " --fork return immediately if a command is specified\n" +" --verbose 'level' Set the desired log level\n" }, { "start",
@@ -113,6 +115,7 @@ static struct usage_help usage_help[] = {" It only enables the tracing and exits\n" "\n" " --fork: If a command is specified, then return right after it forks\n" +" --verbose 'level' Set the desired log level\n" }, { "extract",
@@ -123,6 +126,7 @@ static struct usage_help usage_help[] = {" -B : extract a given buffer (more than one may be specified)\n" " -a : extract all buffers (except top one)\n" " -t : extract the top level buffer (useful with -B and -a)\n" +" --verbose 'level' Set the desired log level\n" }, { "stop",
@@ -241,6 +245,7 @@ static struct usage_help usage_help[] = {"Start tracing and read the output directly" ," %s stream [-e event][-p plugin][-d][-O option ][-P pid]\n" " Uses same options as record but does not write to files or the network.\n" +" --verbose 'level' Set the desired log level\n" }, { "profile",
@@ -249,6 +254,7 @@ static struct usage_help usage_help[] = {" [-H [start_system:]start_event,start_match[,pid]/[end_system:]end_event,end_match[,flags]\n\n" " Uses same options as record --profile.\n" " -H Allows users to hook two events together for timings\n" +" --verbose 'level' Set the desired log level\n" }, { "hist",
Signature · 1 line
2.30.2
PATCH 5/7 trace-cmd listen: Add --verbose
In reply to Tzvetomir Stoyanov (VMware)Add new "trace-cmd listen --verbose" argument for setting the desired log level.
--- Documentation/trace-cmd/trace-cmd-listen.1.txt | 8 ++++++++ tracecmd/trace-listen.c | 6 ++++++ tracecmd/trace-usage.c | 1 + 3 files changed, 15 insertions(+)
Documentation/trace-cmd/trace-cmd-listen.1.txt +8 -0
@@ -36,6 +36,14 @@ OPTIONS *-l* 'filename':: This option writes the output messages to a log file instead of standard output. +*--verbose* 'level':: + Set the log level. Supported log levels are "none", "critical", "error", "warning", + "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log + level to specific value enables all logs from that and all previous levels. + + Example: enable all critical, error and warning logs + + trace-cmd listen --verbose warning SEE ALSO --------
tracecmd/trace-listen.c +6 -0
@@ -916,6 +916,7 @@ static void start_daemon(void) }enum { + OPT_verbose =254 , OPT_debug =255 , };
@@ -938,6 +939,7 @@ void trace_listen(int argc, char **argv) {"port", required_argument, NULL, 'p'}, {"help", no_argument, NULL, '?'}, {"debug", no_argument, NULL, OPT_debug}, + {"verbose", required_argument, NULL, OPT_verbose}, {NULL, 0, NULL, 0} };
@@ -967,6 +969,10 @@ void trace_listen(int argc, char **argv)case OPT_debug:tracecmd_set_debug (true);break ; +case OPT_verbose: +if (trace_set_verbose (optarg) <0 ) +die ("invalid verbose level %s" , optarg); +break ;default :usage (argv); }
tracecmd/trace-usage.c +1 -0
@@ -300,6 +300,7 @@ static struct usage_help usage_help[] = { " -o file name to use for clients.\n" " -d directory to store client files.\n" " -l logfile to write messages to.\n" + " --verbose 'level' Set the desired log level\n" },#ifdef VSOCK {
Signature · 1 line
2.30.2
PATCH 6/7 trace-cmd stack: Add --verbose
In reply to Tzvetomir Stoyanov (VMware)Add new "trace-cmd stack --verbose" argument for setting the desired log level.
--- Documentation/trace-cmd/trace-cmd-stack.1.txt | 4 ++++ tracecmd/trace-stack.c | 6 ++++++ tracecmd/trace-usage.c | 1 + 3 files changed, 11 insertions(+)
Documentation/trace-cmd/trace-cmd-stack.1.txt +4 -0
@@ -24,6 +24,10 @@ stack found since the start was enabled. Use *--reset* to reset the stack counter to zero. +User *--verbose* 'level' to set the log level. Supported log levels are "none", "critical", "error", +"warning", "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting +the log level to specific value enables all logs from that and all previous levels. + SEE ALSO -------- trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
tracecmd/trace-stack.c +6 -0
@@ -140,6 +140,7 @@ static void read_trace(void) }enum { + OPT_verbose =252 , OPT_reset =253 , OPT_stop =254 , OPT_start =255 ,
@@ -163,6 +164,7 @@ void trace_stack (int argc, char **argv) {"stop", no_argument, NULL, OPT_stop}, {"reset", no_argument, NULL, OPT_reset}, {"help", no_argument, NULL, '?'}, + {"verbose", required_argument, NULL, OPT_verbose}, {NULL, 0, NULL, 0} };
@@ -184,6 +186,10 @@ void trace_stack (int argc, char **argv)case OPT_reset: trace_type =STACK_RESET ;break ; +case OPT_verbose: +if (trace_set_verbose (optarg) <0 ) +die ("invalid verbose level %s" , optarg); +break ;default :usage (argv); }
tracecmd/trace-usage.c +1 -0
@@ -364,6 +364,7 @@ static struct usage_help usage_help[] = {" --start enable the stack tracer\n" " --stop disable the stack tracer\n" " --reset reset the maximum stack found\n" +" --verbose 'level' Set the desired log level\n" }, { "check-events",
Signature · 1 line
2.30.2
PATCH 7/7 trace-cmd dump: Add --verbose
In reply to Tzvetomir Stoyanov (VMware)Add new "trace-cmd dump --verbose" argument for setting the desired log level.
--- Documentation/trace-cmd/trace-cmd-dump.1.txt | 8 ++++++++ tracecmd/trace-dump.c | 6 ++++++ tracecmd/trace-usage.c | 1 + 3 files changed, 15 insertions(+)
Documentation/trace-cmd/trace-cmd-dump.1.txt +8 -0
@@ -52,6 +52,14 @@ OPTIONS Print all meta data from the file. *--help*:: Print usage information. +*--verbose* 'level':: + Set the log level. Supported log levels are "none", "critical", "error", "warning", + "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log + level to specific value enables all logs from that and all previous levels. + + Example: enable all critical, error and warning logs + + trace-cmd report --verbose warning EXAMPLES --------
tracecmd/trace-dump.c +6 -0
@@ -678,6 +678,7 @@ static void dump_file(const char *file) }enum { + OPT_verbose =242 , OPT_clock =243 , OPT_all =244 , OPT_summary =245 ,
@@ -722,6 +723,7 @@ void trace_dump(int argc, char **argv) {"clock", no_argument, NULL, OPT_clock}, {"validate", no_argument, NULL, 'v'}, {"help", no_argument, NULL, '?'}, + {"verbose", required_argument, NULL, OPT_verbose}, {NULL, 0, NULL, 0} };
@@ -778,6 +780,10 @@ void trace_dump(int argc, char **argv)case OPT_clock: verbosity |=CLOCK ;break ; +case OPT_verbose: +if (trace_set_verbose (optarg) <0 ) +die ("invalid verbose level %s" , optarg); +break ;default :usage (argv); }
tracecmd/trace-usage.c +1 -0
@@ -393,6 +393,7 @@ static struct usage_help usage_help[] = {" --flyrecord information of offset and count of recorded events per CPU\n" " --clock trace clock, saved in the file\n" " -h, --help show usage information\n" +" --verbose 'level' Set the desired log level\n" }, {NULL ,NULL ,NULL
Signature · 1 line
2.30.2