[PATCH 6/7] trace-cmd stack: Add --verbose

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add new "trace-cmd stack --verbose" argument for setting the desired
log level.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx>
---
 Documentation/trace-cmd/trace-cmd-stack.1.txt | 4 ++++
 tracecmd/trace-stack.c                        | 6 ++++++
 tracecmd/trace-usage.c                        | 1 +
 3 files changed, 11 insertions(+)

diff --git a/Documentation/trace-cmd/trace-cmd-stack.1.txt b/Documentation/trace-cmd/trace-cmd-stack.1.txt
index a00c6900..75bd50ba 100644
--- a/Documentation/trace-cmd/trace-cmd-stack.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-stack.1.txt
@@ -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),
diff --git a/tracecmd/trace-stack.c b/tracecmd/trace-stack.c
index 5e88b36c..6f57387a 100644
--- a/tracecmd/trace-stack.c
+++ b/tracecmd/trace-stack.c
@@ -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);
 		}
diff --git a/tracecmd/trace-usage.c b/tracecmd/trace-usage.c
index 4c8b1300..8a7e8c7b 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -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",
-- 
2.30.2




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux