Commit 5ea8abf5 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'trace-tools-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing tools updates from Steven Rostedt:

 - Add auto-analysis only option to rtla/timerlat

   Add an --aa-only option to the tooling to perform only the auto
   analysis and not to parse and format the data.

 - Other minor fixes and clean ups

* tag 'trace-tools-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  rtla/timerlat: Fix "Previous IRQ" auto analysis' line
  rtla/timerlat: Add auto-analysis only option
  rv: Remove redundant assignment to variable retval
  rv: Fix addition on an uninitialized variable 'run'
  rtla: Add .gitignore file
parents d579c468 82253a27
...@@ -5,3 +5,10 @@ ...@@ -5,3 +5,10 @@
**--no-aa** **--no-aa**
disable auto-analysis, reducing rtla timerlat cpu usage disable auto-analysis, reducing rtla timerlat cpu usage
**--aa-only** *us*
Set stop tracing conditions and run without collecting and displaying statistics.
Print the auto-analysis if the system hits the stop tracing condition. This option
is useful to reduce rtla timerlat CPU, enabling the debug without the overhead of
collecting the statistics.
...@@ -290,8 +290,6 @@ static ssize_t monitor_enable_write_data(struct file *filp, const char __user *u ...@@ -290,8 +290,6 @@ static ssize_t monitor_enable_write_data(struct file *filp, const char __user *u
if (retval) if (retval)
return retval; return retval;
retval = count;
mutex_lock(&rv_interface_lock); mutex_lock(&rv_interface_lock);
if (val) if (val)
......
...@@ -548,7 +548,7 @@ static void timerlat_thread_analysis(struct timerlat_aa_data *taa_data, int cpu, ...@@ -548,7 +548,7 @@ static void timerlat_thread_analysis(struct timerlat_aa_data *taa_data, int cpu,
exp_irq_ts = taa_data->timer_irq_start_time - taa_data->timer_irq_start_delay; exp_irq_ts = taa_data->timer_irq_start_time - taa_data->timer_irq_start_delay;
if (exp_irq_ts < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) if (exp_irq_ts < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration)
printf(" Previous IRQ interference: \t up to %9.2f us", printf(" Previous IRQ interference: \t\t up to %9.2f us\n",
ns_to_usf(taa_data->prev_irq_duration)); ns_to_usf(taa_data->prev_irq_duration));
/* /*
......
...@@ -33,6 +33,7 @@ struct timerlat_top_params { ...@@ -33,6 +33,7 @@ struct timerlat_top_params {
int set_sched; int set_sched;
int dma_latency; int dma_latency;
int no_aa; int no_aa;
int aa_only;
int dump_tasks; int dump_tasks;
struct sched_attr sched_param; struct sched_attr sched_param;
struct trace_events *events; struct trace_events *events;
...@@ -142,10 +143,12 @@ timerlat_top_handler(struct trace_seq *s, struct tep_record *record, ...@@ -142,10 +143,12 @@ timerlat_top_handler(struct trace_seq *s, struct tep_record *record,
top = container_of(trace, struct osnoise_tool, trace); top = container_of(trace, struct osnoise_tool, trace);
params = top->params; params = top->params;
tep_get_field_val(s, event, "context", record, &thread, 1); if (!params->aa_only) {
tep_get_field_val(s, event, "timer_latency", record, &latency, 1); tep_get_field_val(s, event, "context", record, &thread, 1);
tep_get_field_val(s, event, "timer_latency", record, &latency, 1);
timerlat_top_update(top, cpu, thread, latency); timerlat_top_update(top, cpu, thread, latency);
}
if (!params->no_aa) if (!params->no_aa)
timerlat_aa_handler(s, record, event, context); timerlat_aa_handler(s, record, event, context);
...@@ -250,6 +253,9 @@ timerlat_print_stats(struct timerlat_top_params *params, struct osnoise_tool *to ...@@ -250,6 +253,9 @@ timerlat_print_stats(struct timerlat_top_params *params, struct osnoise_tool *to
static int nr_cpus = -1; static int nr_cpus = -1;
int i; int i;
if (params->aa_only)
return;
if (nr_cpus == -1) if (nr_cpus == -1)
nr_cpus = sysconf(_SC_NPROCESSORS_CONF); nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
...@@ -279,10 +285,11 @@ static void timerlat_top_usage(char *usage) ...@@ -279,10 +285,11 @@ static void timerlat_top_usage(char *usage)
"", "",
" usage: rtla timerlat [top] [-h] [-q] [-a us] [-d s] [-D] [-n] [-p us] [-i us] [-T us] [-s us] \\", " usage: rtla timerlat [top] [-h] [-q] [-a us] [-d s] [-D] [-n] [-p us] [-i us] [-T us] [-s us] \\",
" [[-t[=file]] [-e sys[:event]] [--filter <filter>] [--trigger <trigger>] [-c cpu-list] \\", " [[-t[=file]] [-e sys[:event]] [--filter <filter>] [--trigger <trigger>] [-c cpu-list] \\",
" [-P priority] [--dma-latency us]", " [-P priority] [--dma-latency us] [--aa-only us]",
"", "",
" -h/--help: print this menu", " -h/--help: print this menu",
" -a/--auto: set automatic trace mode, stopping the session if argument in us latency is hit", " -a/--auto: set automatic trace mode, stopping the session if argument in us latency is hit",
" --aa-only us: stop if <us> latency is hit, only printing the auto analysis (reduces CPU usage)",
" -p/--period us: timerlat period in us", " -p/--period us: timerlat period in us",
" -i/--irq us: stop trace if the irq latency is higher than the argument in us", " -i/--irq us: stop trace if the irq latency is higher than the argument in us",
" -T/--thread us: stop trace if the thread latency is higher than the argument in us", " -T/--thread us: stop trace if the thread latency is higher than the argument in us",
...@@ -362,13 +369,14 @@ static struct timerlat_top_params ...@@ -362,13 +369,14 @@ static struct timerlat_top_params
{"dma-latency", required_argument, 0, '2'}, {"dma-latency", required_argument, 0, '2'},
{"no-aa", no_argument, 0, '3'}, {"no-aa", no_argument, 0, '3'},
{"dump-tasks", no_argument, 0, '4'}, {"dump-tasks", no_argument, 0, '4'},
{"aa-only", required_argument, 0, '5'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
/* getopt_long stores the option index here. */ /* getopt_long stores the option index here. */
int option_index = 0; int option_index = 0;
c = getopt_long(argc, argv, "a:c:d:De:hi:np:P:qs:t::T:0:1:2:34", c = getopt_long(argc, argv, "a:c:d:De:hi:np:P:qs:t::T:0:1:2:345:",
long_options, &option_index); long_options, &option_index);
/* detect the end of the options. */ /* detect the end of the options. */
...@@ -389,6 +397,20 @@ static struct timerlat_top_params ...@@ -389,6 +397,20 @@ static struct timerlat_top_params
/* set trace */ /* set trace */
params->trace_output = "timerlat_trace.txt"; params->trace_output = "timerlat_trace.txt";
break; break;
case '5':
/* it is here because it is similar to -a */
auto_thresh = get_llong_from_str(optarg);
/* set thread stop to auto_thresh */
params->stop_total_us = auto_thresh;
params->stop_us = auto_thresh;
/* get stack trace */
params->print_stack = auto_thresh;
/* set aa_only to avoid parsing the trace */
params->aa_only = 1;
break;
case 'c': case 'c':
retval = parse_cpu_list(optarg, &params->monitored_cpus); retval = parse_cpu_list(optarg, &params->monitored_cpus);
if (retval) if (retval)
...@@ -503,6 +525,9 @@ static struct timerlat_top_params ...@@ -503,6 +525,9 @@ static struct timerlat_top_params
if (!params->stop_us && !params->stop_total_us) if (!params->stop_us && !params->stop_total_us)
params->no_aa = 1; params->no_aa = 1;
if (params->no_aa && params->aa_only)
timerlat_top_usage("--no-aa and --aa-only are mutually exclusive!");
return params; return params;
} }
...@@ -634,6 +659,7 @@ int timerlat_top_main(int argc, char *argv[]) ...@@ -634,6 +659,7 @@ int timerlat_top_main(int argc, char *argv[])
struct trace_instance *trace; struct trace_instance *trace;
int dma_latency_fd = -1; int dma_latency_fd = -1;
int return_value = 1; int return_value = 1;
char *max_lat;
int retval; int retval;
params = timerlat_top_parse_args(argc, argv); params = timerlat_top_parse_args(argc, argv);
...@@ -700,6 +726,9 @@ int timerlat_top_main(int argc, char *argv[]) ...@@ -700,6 +726,9 @@ int timerlat_top_main(int argc, char *argv[])
while (!stop_tracing) { while (!stop_tracing) {
sleep(params->sleep_time); sleep(params->sleep_time);
if (params->aa_only && !trace_is_off(&top->trace, &record->trace))
continue;
retval = tracefs_iterate_raw_events(trace->tep, retval = tracefs_iterate_raw_events(trace->tep,
trace->inst, trace->inst,
NULL, NULL,
...@@ -733,6 +762,16 @@ int timerlat_top_main(int argc, char *argv[]) ...@@ -733,6 +762,16 @@ int timerlat_top_main(int argc, char *argv[])
printf(" Saving trace to %s\n", params->trace_output); printf(" Saving trace to %s\n", params->trace_output);
save_trace_to_file(record->trace.inst, params->trace_output); save_trace_to_file(record->trace.inst, params->trace_output);
} }
} else if (params->aa_only) {
/*
* If the trace did not stop with --aa-only, at least print the
* max known latency.
*/
max_lat = tracefs_instance_file_read(trace->inst, "tracing_max_latency", NULL);
if (max_lat) {
printf(" Max latency was %s\n", max_lat);
free(max_lat);
}
} }
out_top: out_top:
......
...@@ -74,7 +74,7 @@ static void rv_list(int argc, char **argv) ...@@ -74,7 +74,7 @@ static void rv_list(int argc, char **argv)
static void rv_mon(int argc, char **argv) static void rv_mon(int argc, char **argv)
{ {
char *monitor_name; char *monitor_name;
int i, run; int i, run = 0;
static const char *const usage[] = { static const char *const usage[] = {
"", "",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment