Skip to content

Commit 2b622ed

Browse files
Daniel Bristot de Oliveirarostedt
authored andcommitted
rtla/osnoise: Add the automatic trace option
Add the -a/--auto <arg in us> option. This option sets some commonly used options while debugging the system. It aims to help users produce reports in the field, reducing the number of arguments passed to the tool in the first approach to a problem. It is equivalent to setting osnoise/stop_tracing_us with the argument, setting tracing_thresh to 1 us, and saving the trace to osnoise_trace.txt file if the trace is stopped automatically. Link: https://lkml.kernel.org/r/ef04c961b227eb93a83cd0b54bfca45e1a381b77.1646247211.git.bristot@kernel.org Cc: Daniel Bristot de Oliveira <bristot@kernel.org> Cc: Clark Williams <williams@redhat.com> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent d635316 commit 2b622ed

3 files changed

Lines changed: 37 additions & 6 deletions

File tree

Documentation/tools/rtla/common_osnoise_options.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
**-a**, **--auto** *us*
2+
3+
Set the automatic trace mode. This mode sets some commonly used options
4+
while debugging the system. It is equivalent to use **-s** *us* **-T 1 -t**.
5+
16
**-p**, **--period** *us*
27

38
Set the *osnoise* tracer period in microseconds.

tools/tracing/rtla/src/osnoise_hist.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,12 @@ static void osnoise_hist_usage(char *usage)
426426

427427
static const char * const msg[] = {
428428
"",
429-
" usage: rtla osnoise hist [-h] [-D] [-d s] [-p us] [-r us] [-s us] [-S us] [-T us] \\",
430-
" [-t[=file]] [-c cpu-list] [-P priority] [-b N] [-E N] [--no-header] \\",
429+
" usage: rtla osnoise hist [-h] [-D] [-d s] [-a us] [-p us] [-r us] [-s us] [-S us] \\",
430+
" [-T us] [-t[=file]] [-c cpu-list] [-P priority] [-b N] [-E N] [--no-header] \\",
431431
" [--no-summary] [--no-index] [--with-zeros]",
432432
"",
433433
" -h/--help: print this menu",
434+
" -a/--auto: set automatic trace mode, stopping the session if argument in us sample is hit",
434435
" -p/--period us: osnoise period in us",
435436
" -r/--runtime us: osnoise runtime in us",
436437
" -s/--stop us: stop trace if a single sample is higher than the argument in us",
@@ -487,6 +488,7 @@ static struct osnoise_hist_params
487488

488489
while (1) {
489490
static struct option long_options[] = {
491+
{"auto", required_argument, 0, 'a'},
490492
{"bucket-size", required_argument, 0, 'b'},
491493
{"entries", required_argument, 0, 'E'},
492494
{"cpus", required_argument, 0, 'c'},
@@ -510,14 +512,25 @@ static struct osnoise_hist_params
510512
/* getopt_long stores the option index here. */
511513
int option_index = 0;
512514

513-
c = getopt_long(argc, argv, "c:b:d:E:Dhp:P:r:s:S:t::T:0123",
515+
c = getopt_long(argc, argv, "a:c:b:d:E:Dhp:P:r:s:S:t::T:0123",
514516
long_options, &option_index);
515517

516518
/* detect the end of the options. */
517519
if (c == -1)
518520
break;
519521

520522
switch (c) {
523+
case 'a':
524+
/* set sample stop to auto_thresh */
525+
params->stop_us = get_llong_from_str(optarg);
526+
527+
/* set sample threshold to 1 */
528+
params->threshold = 1;
529+
530+
/* set trace */
531+
params->trace_output = "osnoise_trace.txt";
532+
533+
break;
521534
case 'b':
522535
params->bucket_size = get_llong_from_str(optarg);
523536
if ((params->bucket_size == 0) || (params->bucket_size >= 1000000))

tools/tracing/rtla/src/osnoise_top.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,11 @@ void osnoise_top_usage(char *usage)
245245
int i;
246246

247247
static const char * const msg[] = {
248-
" usage: rtla osnoise [top] [-h] [-q] [-D] [-d s] [-p us] [-r us] [-s us] [-S us] [-T us] \\",
249-
" [-t[=file]] [-c cpu-list] [-P priority]",
248+
" usage: rtla osnoise [top] [-h] [-q] [-D] [-d s] [-a us] [-p us] [-r us] [-s us] [-S us] \\",
249+
" [-T us] [-t[=file]] [-c cpu-list] [-P priority]",
250250
"",
251251
" -h/--help: print this menu",
252+
" -a/--auto: set automatic trace mode, stopping the session if argument in us sample is hit",
252253
" -p/--period us: osnoise period in us",
253254
" -r/--runtime us: osnoise runtime in us",
254255
" -s/--stop us: stop trace if a single sample is higher than the argument in us",
@@ -294,6 +295,7 @@ struct osnoise_top_params *osnoise_top_parse_args(int argc, char **argv)
294295

295296
while (1) {
296297
static struct option long_options[] = {
298+
{"auto", required_argument, 0, 'a'},
297299
{"cpus", required_argument, 0, 'c'},
298300
{"debug", no_argument, 0, 'D'},
299301
{"duration", required_argument, 0, 'd'},
@@ -312,14 +314,25 @@ struct osnoise_top_params *osnoise_top_parse_args(int argc, char **argv)
312314
/* getopt_long stores the option index here. */
313315
int option_index = 0;
314316

315-
c = getopt_long(argc, argv, "c:d:Dhp:P:qr:s:S:t::T:",
317+
c = getopt_long(argc, argv, "a:c:d:Dhp:P:qr:s:S:t::T:",
316318
long_options, &option_index);
317319

318320
/* Detect the end of the options. */
319321
if (c == -1)
320322
break;
321323

322324
switch (c) {
325+
case 'a':
326+
/* set sample stop to auto_thresh */
327+
params->stop_us = get_llong_from_str(optarg);
328+
329+
/* set sample threshold to 1 */
330+
params->threshold = 1;
331+
332+
/* set trace */
333+
params->trace_output = "osnoise_trace.txt";
334+
335+
break;
323336
case 'c':
324337
retval = parse_cpu_list(optarg, &params->monitored_cpus);
325338
if (retval)

0 commit comments

Comments
 (0)