From 0bf03b411e79b7985bcce4d3a96db37ca117a56c Mon Sep 17 00:00:00 2001 From: Kaige Fu Date: Sun, 1 Dec 2019 22:01:02 +0000 Subject: [PATCH] acrntrace: Set FLAG_CLEAR_BUF by default Normally, we care more about the current trace data than buffered old data. So, this patch set FLAG_CLEAR_BUF by default and adds one new option '-r' to unset the FLAG_CLEAR_BUF if we want to capture the buffered old data. --- v1 -> v2: Add 'deprecated' mark to '-c' option Tracked-On: #4175 Signed-off-by: Kaige Fu --- misc/tools/acrntrace/README.rst | 3 ++- misc/tools/acrntrace/acrntrace.c | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/misc/tools/acrntrace/README.rst b/misc/tools/acrntrace/README.rst index 786427f8f..d0823be62 100644 --- a/misc/tools/acrntrace/README.rst +++ b/misc/tools/acrntrace/README.rst @@ -23,7 +23,8 @@ Options: -h print this message -i period specify polling interval in milliseconds [1-999] -t max_time max time to capture trace data (in second) --c clear the buffered old data +-c clear the buffered old data (deprecated) +-r capture the buffered old data instead of clearing it -a cpu-set only capture the trace data on these configured cpu-set acrntrace_format.py diff --git a/misc/tools/acrntrace/acrntrace.c b/misc/tools/acrntrace/acrntrace.c index 2cbdef985..261e13b0f 100644 --- a/misc/tools/acrntrace/acrntrace.c +++ b/misc/tools/acrntrace/acrntrace.c @@ -30,10 +30,10 @@ static int exiting = 0; /* for opt */ static uint64_t period = 10000; -static const char optString[] = "i:hct:a:"; +static const char optString[] = "i:hcrt:a:"; static const char dev_prefix[] = "acrn_trace_"; -static uint32_t flags; +static uint32_t flags = FLAG_CLEAR_BUF; static char trace_file_dir[TRACE_FILE_DIR_LEN]; static reader_struct *reader; @@ -49,7 +49,8 @@ static void display_usage(void) "\t-h: print this message\n" "\t-i: period_in_ms: specify polling interval [1-999]\n" "\t-t: max time to capture trace data (in second)\n" - "\t-c: clear the buffered old data\n" + "\t-c: clear the buffered old data (deprecated)\n" + "\t-r: capture the buffered old data instead of clearing it\n" "\t-a: cpu-set: only capture the trace data on these configured cpu-set\n"); } @@ -117,8 +118,14 @@ static int parse_opt(int argc, char *argv[]) timeout = ret; pr_dbg("Capture trace data for at most %ds\n", ret); break; + /* + * We have set the FLAG_CLEAR_BUF by default. + * Here we just keep the -c for backward compatibility. + */ case 'c': - flags |= FLAG_CLEAR_BUF; + break; + case 'r': + flags &= ~FLAG_CLEAR_BUF; break; case 'a': cpu_bitmask = numa_parse_cpustring_all(optarg);