Lines Matching +full:duration +full:- +full:us

1 // SPDX-License-Identifier: GPL-2.0
36 int duration; member
84 * timerlat_free_top - free runtime data
89 free(data->cpu_data); in timerlat_free_top()
94 * timerlat_alloc_histogram - alloc runtime data
105 data->nr_cpus = nr_cpus; in timerlat_alloc_top()
108 data->cpu_data = calloc(1, sizeof(*data->cpu_data) * nr_cpus); in timerlat_alloc_top()
109 if (!data->cpu_data) in timerlat_alloc_top()
114 data->cpu_data[cpu].min_irq = ~0; in timerlat_alloc_top()
115 data->cpu_data[cpu].min_thread = ~0; in timerlat_alloc_top()
116 data->cpu_data[cpu].min_user = ~0; in timerlat_alloc_top()
130 summary->min_irq = ~0; in timerlat_top_reset_sum()
131 summary->min_thread = ~0; in timerlat_top_reset_sum()
132 summary->min_user = ~0; in timerlat_top_reset_sum()
138 struct timerlat_top_data *data = tool->data; in timerlat_top_update_sum()
139 struct timerlat_top_cpu *cpu_data = &data->cpu_data[cpu]; in timerlat_top_update_sum()
141 sum->irq_count += cpu_data->irq_count; in timerlat_top_update_sum()
142 update_min(&sum->min_irq, &cpu_data->min_irq); in timerlat_top_update_sum()
143 update_sum(&sum->sum_irq, &cpu_data->sum_irq); in timerlat_top_update_sum()
144 update_max(&sum->max_irq, &cpu_data->max_irq); in timerlat_top_update_sum()
146 sum->thread_count += cpu_data->thread_count; in timerlat_top_update_sum()
147 update_min(&sum->min_thread, &cpu_data->min_thread); in timerlat_top_update_sum()
148 update_sum(&sum->sum_thread, &cpu_data->sum_thread); in timerlat_top_update_sum()
149 update_max(&sum->max_thread, &cpu_data->max_thread); in timerlat_top_update_sum()
151 sum->user_count += cpu_data->user_count; in timerlat_top_update_sum()
152 update_min(&sum->min_user, &cpu_data->min_user); in timerlat_top_update_sum()
153 update_sum(&sum->sum_user, &cpu_data->sum_user); in timerlat_top_update_sum()
154 update_max(&sum->max_user, &cpu_data->max_user); in timerlat_top_update_sum()
158 * timerlat_hist_update - record a new timerlat occurent on cpu, updating data
165 struct timerlat_top_data *data = tool->data; in timerlat_top_update()
166 struct timerlat_top_cpu *cpu_data = &data->cpu_data[cpu]; in timerlat_top_update()
169 cpu_data->irq_count++; in timerlat_top_update()
170 cpu_data->cur_irq = latency; in timerlat_top_update()
171 update_min(&cpu_data->min_irq, &latency); in timerlat_top_update()
172 update_sum(&cpu_data->sum_irq, &latency); in timerlat_top_update()
173 update_max(&cpu_data->max_irq, &latency); in timerlat_top_update()
175 cpu_data->thread_count++; in timerlat_top_update()
176 cpu_data->cur_thread = latency; in timerlat_top_update()
177 update_min(&cpu_data->min_thread, &latency); in timerlat_top_update()
178 update_sum(&cpu_data->sum_thread, &latency); in timerlat_top_update()
179 update_max(&cpu_data->max_thread, &latency); in timerlat_top_update()
181 cpu_data->user_count++; in timerlat_top_update()
182 cpu_data->cur_user = latency; in timerlat_top_update()
183 update_min(&cpu_data->min_user, &latency); in timerlat_top_update()
184 update_sum(&cpu_data->sum_user, &latency); in timerlat_top_update()
185 update_max(&cpu_data->max_user, &latency); in timerlat_top_update()
190 * timerlat_top_handler - this is the handler for timerlat tracer events
200 int cpu = record->cpu; in timerlat_top_handler()
203 params = top->params; in timerlat_top_handler()
205 if (!params->aa_only) { in timerlat_top_handler()
216 * timerlat_top_header - print the header of the tool output
220 struct trace_seq *s = top->trace.seq; in timerlat_top_header()
221 char duration[26]; in timerlat_top_header() local
223 get_duration(top->start_time, duration, sizeof(duration)); in timerlat_top_header()
225 if (params->pretty_output) in timerlat_top_header()
229 if (params->user_top) in timerlat_top_header()
232 if (params->pretty_output) in timerlat_top_header()
236 …trace_seq_printf(s, "%-6s | IRQ Timer Latency (%s) | Thread Timer Latenc… in timerlat_top_header()
237 params->output_divisor == 1 ? "ns" : "us", in timerlat_top_header()
238 params->output_divisor == 1 ? "ns" : "us"); in timerlat_top_header()
240 if (params->user_top) { in timerlat_top_header()
242 params->output_divisor == 1 ? "ns" : "us"); in timerlat_top_header()
246 if (params->pretty_output) in timerlat_top_header()
250 if (params->user_top) in timerlat_top_header()
253 if (params->pretty_output) in timerlat_top_header()
258 static const char *no_value = " -";
261 * timerlat_top_print - prints the output of a given CPU
266 struct timerlat_top_params *params = top->params; in timerlat_top_print()
267 struct timerlat_top_data *data = top->data; in timerlat_top_print()
268 struct timerlat_top_cpu *cpu_data = &data->cpu_data[cpu]; in timerlat_top_print()
269 int divisor = params->output_divisor; in timerlat_top_print()
270 struct trace_seq *s = top->trace.seq; in timerlat_top_print()
278 if (!cpu_data->irq_count && !cpu_data->thread_count) in timerlat_top_print()
284 trace_seq_printf(s, "%3d #%-9llu |", cpu, cpu_data->irq_count); in timerlat_top_print()
286 if (!cpu_data->irq_count) { in timerlat_top_print()
289 trace_seq_printf(s, "%9llu ", cpu_data->cur_irq / params->output_divisor); in timerlat_top_print()
290 trace_seq_printf(s, "%9llu ", cpu_data->min_irq / params->output_divisor); in timerlat_top_print()
291 trace_seq_printf(s, "%9llu ", (cpu_data->sum_irq / cpu_data->irq_count) / divisor); in timerlat_top_print()
292 trace_seq_printf(s, "%9llu |", cpu_data->max_irq / divisor); in timerlat_top_print()
295 if (!cpu_data->thread_count) { in timerlat_top_print()
298 trace_seq_printf(s, "%9llu ", cpu_data->cur_thread / divisor); in timerlat_top_print()
299 trace_seq_printf(s, "%9llu ", cpu_data->min_thread / divisor); in timerlat_top_print()
301 (cpu_data->sum_thread / cpu_data->thread_count) / divisor); in timerlat_top_print()
302 trace_seq_printf(s, "%9llu", cpu_data->max_thread / divisor); in timerlat_top_print()
305 if (!params->user_top) { in timerlat_top_print()
312 if (!cpu_data->user_count) { in timerlat_top_print()
315 trace_seq_printf(s, "%9llu ", cpu_data->cur_user / divisor); in timerlat_top_print()
316 trace_seq_printf(s, "%9llu ", cpu_data->min_user / divisor); in timerlat_top_print()
318 (cpu_data->sum_user / cpu_data->user_count) / divisor); in timerlat_top_print()
319 trace_seq_printf(s, "%9llu\n", cpu_data->max_user / divisor); in timerlat_top_print()
324 * timerlat_top_print_sum - prints the summary output
329 const char *split = "----------------------------------------"; in timerlat_top_print_sum()
330 struct timerlat_top_params *params = top->params; in timerlat_top_print_sum()
331 unsigned long long count = summary->irq_count; in timerlat_top_print_sum()
332 int divisor = params->output_divisor; in timerlat_top_print_sum()
333 struct trace_seq *s = top->trace.seq; in timerlat_top_print_sum()
342 if (!summary->irq_count && !summary->thread_count) in timerlat_top_print_sum()
351 if (params->user_top) in timerlat_top_print_sum()
352 trace_seq_printf(s, "-|%.*s", 39, split); in timerlat_top_print_sum()
355 trace_seq_printf(s, "ALL #%-6llu e%d |", count, e); in timerlat_top_print_sum()
357 if (!summary->irq_count) { in timerlat_top_print_sum()
361 trace_seq_printf(s, "%9llu ", summary->min_irq / params->output_divisor); in timerlat_top_print_sum()
362 trace_seq_printf(s, "%9llu ", (summary->sum_irq / summary->irq_count) / divisor); in timerlat_top_print_sum()
363 trace_seq_printf(s, "%9llu |", summary->max_irq / divisor); in timerlat_top_print_sum()
366 if (!summary->thread_count) { in timerlat_top_print_sum()
370 trace_seq_printf(s, "%9llu ", summary->min_thread / divisor); in timerlat_top_print_sum()
372 (summary->sum_thread / summary->thread_count) / divisor); in timerlat_top_print_sum()
373 trace_seq_printf(s, "%9llu", summary->max_thread / divisor); in timerlat_top_print_sum()
376 if (!params->user_top) { in timerlat_top_print_sum()
383 if (!summary->user_count) { in timerlat_top_print_sum()
387 trace_seq_printf(s, "%9llu ", summary->min_user / divisor); in timerlat_top_print_sum()
389 (summary->sum_user / summary->user_count) / divisor); in timerlat_top_print_sum()
390 trace_seq_printf(s, "%9llu\n", summary->max_user / divisor); in timerlat_top_print_sum()
395 * clear_terminal - clears the output terminal
404 * timerlat_print_stats - print data for all cpus
409 struct trace_instance *trace = &top->trace; in timerlat_print_stats()
411 static int nr_cpus = -1; in timerlat_print_stats()
414 if (params->aa_only) in timerlat_print_stats()
417 if (nr_cpus == -1) in timerlat_print_stats()
420 if (!params->quiet) in timerlat_print_stats()
421 clear_terminal(trace->seq); in timerlat_print_stats()
428 if (params->cpus && !CPU_ISSET(i, &params->monitored_cpus)) in timerlat_print_stats()
436 trace_seq_do_printf(trace->seq); in timerlat_print_stats()
437 trace_seq_reset(trace->seq); in timerlat_print_stats()
441 * timerlat_top_usage - prints timerlat top usage message
449 …" usage: rtla timerlat [top] [-h] [-q] [-a us] [-d s] [-D] [-n] [-p us] [-i us] [-T us] [-s us] \… in timerlat_top_usage()
450 …" [[-t[file]] [-e sys[:event]] [--filter <filter>] [--trigger <trigger>] [-c cpu-list] [-H cpu-l… in timerlat_top_usage()
451 …" [-P priority] [--dma-latency us] [--aa-only us] [-C[=cgroup_name]] [-u|-k] [--warm-up s] [--de… in timerlat_top_usage()
453 " -h/--help: print this menu", in timerlat_top_usage()
454 " -a/--auto: set automatic trace mode, stopping the session if argument in us latency is hit", in timerlat_top_usage()
455 …" --aa-only us: stop if <us> latency is hit, only printing the auto analysis (reduces CPU usa… in timerlat_top_usage()
456 " -p/--period us: timerlat period in us", in timerlat_top_usage()
457 " -i/--irq us: stop trace if the irq latency is higher than the argument in us", in timerlat_top_usage()
458 " -T/--thread us: stop trace if the thread latency is higher than the argument in us", in timerlat_top_usage()
459 …" -s/--stack us: save the stack trace at the IRQ if a thread latency is higher than the argument… in timerlat_top_usage()
460 " -c/--cpus cpus: run the tracer only on the given cpus", in timerlat_top_usage()
461 " -H/--house-keeping cpus: run rtla control threads only on the given cpus", in timerlat_top_usage()
462 …" -C/--cgroup[=cgroup_name]: set cgroup, if no cgroup_name is passed, the rtla's cgroup will be … in timerlat_top_usage()
463 " -d/--duration time[s|m|h|d]: duration of the session", in timerlat_top_usage()
464 " -D/--debug: print debug info", in timerlat_top_usage()
465 …" --dump-tasks: prints the task running on all CPUs if stop conditions are met (depends on !-… in timerlat_top_usage()
466 " -t/--trace[file]: save the stopped trace to [file|timerlat_trace.txt]", in timerlat_top_usage()
467 …" -e/--event <sys:event>: enable the <sys:event> in the trace instance, multiple -e are allowed", in timerlat_top_usage()
468 " --filter <command>: enable a trace event filter to the previous -e event", in timerlat_top_usage()
469 " --trigger <command>: enable a trace event trigger to the previous -e event", in timerlat_top_usage()
470 " -n/--nano: display data in nanoseconds", in timerlat_top_usage()
471 " --no-aa: disable auto-analysis, reducing rtla timerlat cpu usage", in timerlat_top_usage()
472 " -q/--quiet print only a summary at the end", in timerlat_top_usage()
473 " --dma-latency us: set /dev/cpu_dma_latency latency <us> to reduce exit from idle latency", in timerlat_top_usage()
474 " -P/--priority o:prio|r:prio|f:prio|d:runtime:period : set scheduling parameters", in timerlat_top_usage()
475 " o:prio - use SCHED_OTHER with prio", in timerlat_top_usage()
476 " r:prio - use SCHED_RR with prio", in timerlat_top_usage()
477 " f:prio - use SCHED_FIFO with prio", in timerlat_top_usage()
478 " d:runtime[us|ms|s]:period[us|ms|s] - use SCHED_DEADLINE with runtime and period", in timerlat_top_usage()
480 " -u/--user-threads: use rtla user-space threads instead of kernel-space timerlat threads", in timerlat_top_usage()
481 " -k/--kernel-threads: use timerlat kernel-space threads instead of rtla user-space threads", in timerlat_top_usage()
482 " -U/--user-load: enable timerlat for user-defined user-space workload", in timerlat_top_usage()
483 " --warm-up s: let the workload run for s seconds before collecting data", in timerlat_top_usage()
484 " --trace-buffer-size kB: set the per-cpu trace buffer size in kB", in timerlat_top_usage()
485 …" --deepest-idle-state n: only go down to idle state n on cpus used by timerlat to reduce exi… in timerlat_top_usage()
492 fprintf(stderr, "rtla timerlat top: a per-cpu summary of the timer latency (version %s)\n", in timerlat_top_usage()
505 * timerlat_top_parse_args - allocs, parse and fill the cmd line parameters
521 params->dma_latency = -1; in timerlat_top_parse_args()
524 params->deepest_idle_state = -2; in timerlat_top_parse_args()
527 params->output_divisor = 1000; in timerlat_top_parse_args()
535 {"duration", required_argument, 0, 'd'}, in timerlat_top_parse_args()
538 {"house-keeping", required_argument, 0, 'H'}, in timerlat_top_parse_args()
547 {"user-threads", no_argument, 0, 'u'}, in timerlat_top_parse_args()
548 {"kernel-threads", no_argument, 0, 'k'}, in timerlat_top_parse_args()
549 {"user-load", no_argument, 0, 'U'}, in timerlat_top_parse_args()
552 {"dma-latency", required_argument, 0, '2'}, in timerlat_top_parse_args()
553 {"no-aa", no_argument, 0, '3'}, in timerlat_top_parse_args()
554 {"dump-tasks", no_argument, 0, '4'}, in timerlat_top_parse_args()
555 {"aa-only", required_argument, 0, '5'}, in timerlat_top_parse_args()
556 {"warm-up", required_argument, 0, '6'}, in timerlat_top_parse_args()
557 {"trace-buffer-size", required_argument, 0, '7'}, in timerlat_top_parse_args()
558 {"deepest-idle-state", required_argument, 0, '8'}, in timerlat_top_parse_args()
569 if (c == -1) in timerlat_top_parse_args()
577 params->stop_total_us = auto_thresh; in timerlat_top_parse_args()
578 params->stop_us = auto_thresh; in timerlat_top_parse_args()
581 params->print_stack = auto_thresh; in timerlat_top_parse_args()
584 params->trace_output = "timerlat_trace.txt"; in timerlat_top_parse_args()
587 /* it is here because it is similar to -a */ in timerlat_top_parse_args()
591 params->stop_total_us = auto_thresh; in timerlat_top_parse_args()
592 params->stop_us = auto_thresh; in timerlat_top_parse_args()
595 params->print_stack = auto_thresh; in timerlat_top_parse_args()
598 params->aa_only = 1; in timerlat_top_parse_args()
601 retval = parse_cpu_set(optarg, &params->monitored_cpus); in timerlat_top_parse_args()
603 timerlat_top_usage("\nInvalid -c cpu list\n"); in timerlat_top_parse_args()
604 params->cpus = optarg; in timerlat_top_parse_args()
607 params->cgroup = 1; in timerlat_top_parse_args()
610 params->cgroup_name = NULL; in timerlat_top_parse_args()
613 params->cgroup_name = ++optarg; in timerlat_top_parse_args()
620 params->duration = parse_seconds_duration(optarg); in timerlat_top_parse_args()
621 if (!params->duration) in timerlat_top_parse_args()
622 timerlat_top_usage("Invalid -d duration\n"); in timerlat_top_parse_args()
631 if (params->events) in timerlat_top_parse_args()
632 tevent->next = params->events; in timerlat_top_parse_args()
633 params->events = tevent; in timerlat_top_parse_args()
640 params->hk_cpus = 1; in timerlat_top_parse_args()
641 retval = parse_cpu_set(optarg, &params->hk_cpu_set); in timerlat_top_parse_args()
648 params->stop_us = get_llong_from_str(optarg); in timerlat_top_parse_args()
651 params->kernel_workload = true; in timerlat_top_parse_args()
654 params->output_divisor = 1; in timerlat_top_parse_args()
657 params->timerlat_period_us = get_llong_from_str(optarg); in timerlat_top_parse_args()
658 if (params->timerlat_period_us > 1000000) in timerlat_top_parse_args()
662 retval = parse_prio(optarg, &params->sched_param); in timerlat_top_parse_args()
663 if (retval == -1) in timerlat_top_parse_args()
664 timerlat_top_usage("Invalid -P priority"); in timerlat_top_parse_args()
665 params->set_sched = 1; in timerlat_top_parse_args()
668 params->quiet = 1; in timerlat_top_parse_args()
671 params->print_stack = get_llong_from_str(optarg); in timerlat_top_parse_args()
674 params->stop_total_us = get_llong_from_str(optarg); in timerlat_top_parse_args()
679 params->trace_output = &optarg[1]; in timerlat_top_parse_args()
681 params->trace_output = &optarg[0]; in timerlat_top_parse_args()
682 } else if (optind < argc && argv[optind][0] != '-') in timerlat_top_parse_args()
683 params->trace_output = argv[optind]; in timerlat_top_parse_args()
685 params->trace_output = "timerlat_trace.txt"; in timerlat_top_parse_args()
689 params->user_workload = true; in timerlat_top_parse_args()
690 /* fallback: -u implies -U */ in timerlat_top_parse_args()
692 params->user_top = true; in timerlat_top_parse_args()
695 if (params->events) { in timerlat_top_parse_args()
696 retval = trace_event_add_trigger(params->events, optarg); in timerlat_top_parse_args()
702 timerlat_top_usage("--trigger requires a previous -e\n"); in timerlat_top_parse_args()
706 if (params->events) { in timerlat_top_parse_args()
707 retval = trace_event_add_filter(params->events, optarg); in timerlat_top_parse_args()
713 timerlat_top_usage("--filter requires a previous -e\n"); in timerlat_top_parse_args()
716 case '2': /* dma-latency */ in timerlat_top_parse_args()
717 params->dma_latency = get_llong_from_str(optarg); in timerlat_top_parse_args()
718 if (params->dma_latency < 0 || params->dma_latency > 10000) { in timerlat_top_parse_args()
719 err_msg("--dma-latency needs to be >= 0 and < 10000"); in timerlat_top_parse_args()
723 case '3': /* no-aa */ in timerlat_top_parse_args()
724 params->no_aa = 1; in timerlat_top_parse_args()
727 params->dump_tasks = 1; in timerlat_top_parse_args()
730 params->warmup = get_llong_from_str(optarg); in timerlat_top_parse_args()
733 params->buffer_size = get_llong_from_str(optarg); in timerlat_top_parse_args()
736 params->deepest_idle_state = get_llong_from_str(optarg); in timerlat_top_parse_args()
751 if (!params->stop_us && !params->stop_total_us) in timerlat_top_parse_args()
752 params->no_aa = 1; in timerlat_top_parse_args()
754 if (params->no_aa && params->aa_only) in timerlat_top_parse_args()
755 timerlat_top_usage("--no-aa and --aa-only are mutually exclusive!"); in timerlat_top_parse_args()
757 if (params->kernel_workload && params->user_workload) in timerlat_top_parse_args()
758 timerlat_top_usage("--kernel-threads and --user-threads are mutually exclusive!"); in timerlat_top_parse_args()
764 * timerlat_top_apply_config - apply the top configs to the initialized tool
772 if (!params->sleep_time) in timerlat_top_apply_config()
773 params->sleep_time = 1; in timerlat_top_apply_config()
775 if (params->cpus) { in timerlat_top_apply_config()
776 retval = osnoise_set_cpus(top->context, params->cpus); in timerlat_top_apply_config()
783 CPU_SET(i, &params->monitored_cpus); in timerlat_top_apply_config()
786 if (params->stop_us) { in timerlat_top_apply_config()
787 retval = osnoise_set_stop_us(top->context, params->stop_us); in timerlat_top_apply_config()
789 err_msg("Failed to set stop us\n"); in timerlat_top_apply_config()
794 if (params->stop_total_us) { in timerlat_top_apply_config()
795 retval = osnoise_set_stop_total_us(top->context, params->stop_total_us); in timerlat_top_apply_config()
797 err_msg("Failed to set stop total us\n"); in timerlat_top_apply_config()
803 if (params->timerlat_period_us) { in timerlat_top_apply_config()
804 retval = osnoise_set_timerlat_period_us(top->context, params->timerlat_period_us); in timerlat_top_apply_config()
812 if (params->print_stack) { in timerlat_top_apply_config()
813 retval = osnoise_set_print_stack(top->context, params->print_stack); in timerlat_top_apply_config()
820 if (params->hk_cpus) { in timerlat_top_apply_config()
821 retval = sched_setaffinity(getpid(), sizeof(params->hk_cpu_set), in timerlat_top_apply_config()
822 &params->hk_cpu_set); in timerlat_top_apply_config()
823 if (retval == -1) { in timerlat_top_apply_config()
827 } else if (params->cpus) { in timerlat_top_apply_config()
829 * Even if the user do not set a house-keeping CPU, try to in timerlat_top_apply_config()
835 auto_house_keeping(&params->monitored_cpus); in timerlat_top_apply_config()
839 * If the user did not specify a type of thread, try user-threads first. in timerlat_top_apply_config()
842 if (!params->kernel_workload && !params->user_top) { in timerlat_top_apply_config()
845 debug_msg("User-space interface detected, setting user-threads\n"); in timerlat_top_apply_config()
846 params->user_workload = 1; in timerlat_top_apply_config()
847 params->user_top = 1; in timerlat_top_apply_config()
849 debug_msg("User-space interface not detected, setting kernel-threads\n"); in timerlat_top_apply_config()
850 params->kernel_workload = 1; in timerlat_top_apply_config()
854 if (params->user_top) { in timerlat_top_apply_config()
855 retval = osnoise_set_workload(top->context, 0); in timerlat_top_apply_config()
862 if (isatty(STDOUT_FILENO) && !params->quiet) in timerlat_top_apply_config()
863 params->pretty_output = 1; in timerlat_top_apply_config()
868 return -1; in timerlat_top_apply_config()
872 * timerlat_init_top - initialize a timerlat top tool with parameters
886 top->data = timerlat_alloc_top(nr_cpus); in timerlat_init_top()
887 if (!top->data) in timerlat_init_top()
890 top->params = params; in timerlat_init_top()
892 tep_register_event_handler(top->trace.tep, -1, "ftrace", "timerlat", in timerlat_init_top()
909 * timerlat_top_set_signals - handles the signal to stop the tool
915 if (params->duration) { in timerlat_top_set_signals()
917 alarm(params->duration); in timerlat_top_set_signals()
929 int dma_latency_fd = -1; in timerlat_top_main()
952 trace = &top->trace; in timerlat_top_main()
960 if (params->set_sched) { in timerlat_top_main()
961 retval = set_comm_sched_attr("timerlat/", &params->sched_param); in timerlat_top_main()
968 if (params->cgroup && !params->user_top) { in timerlat_top_main()
969 retval = set_comm_cgroup("timerlat/", params->cgroup_name); in timerlat_top_main()
976 if (params->dma_latency >= 0) { in timerlat_top_main()
977 dma_latency_fd = set_cpu_dma_latency(params->dma_latency); in timerlat_top_main()
984 if (params->deepest_idle_state >= -1) { in timerlat_top_main()
986 err_msg("rtla built without libcpupower, --deepest-idle-state is not supported\n"); in timerlat_top_main()
993 if (params->cpus && !CPU_ISSET(i, &params->monitored_cpus)) in timerlat_top_main()
999 if (set_deepest_cpu_idle_state(i, params->deepest_idle_state) < 0) { in timerlat_top_main()
1006 if (params->trace_output) { in timerlat_top_main()
1013 if (params->events) { in timerlat_top_main()
1014 retval = trace_events_enable(&record->trace, params->events); in timerlat_top_main()
1019 if (params->buffer_size > 0) { in timerlat_top_main()
1020 retval = trace_set_buffer_size(&record->trace, params->buffer_size); in timerlat_top_main()
1026 if (!params->no_aa) { in timerlat_top_main()
1027 if (params->aa_only) { in timerlat_top_main()
1037 retval = timerlat_aa_init(aa, params->dump_tasks); in timerlat_top_main()
1043 /* if it is re-using the main instance, there is no need to start it */ in timerlat_top_main()
1045 retval = enable_timerlat(&aa->trace); in timerlat_top_main()
1053 if (params->user_workload) { in timerlat_top_main()
1059 params_u.set = &params->monitored_cpus; in timerlat_top_main()
1060 if (params->set_sched) in timerlat_top_main()
1061 params_u.sched_param = &params->sched_param; in timerlat_top_main()
1065 params_u.cgroup_name = params->cgroup_name; in timerlat_top_main()
1069 err_msg("Error creating timerlat user-space threads\n"); in timerlat_top_main()
1072 if (params->warmup > 0) { in timerlat_top_main()
1073 debug_msg("Warming up for %d seconds\n", params->warmup); in timerlat_top_main()
1074 sleep(params->warmup); in timerlat_top_main()
1084 if (params->trace_output) in timerlat_top_main()
1085 trace_instance_start(&record->trace); in timerlat_top_main()
1086 if (!params->no_aa && aa != top) in timerlat_top_main()
1087 trace_instance_start(&aa->trace); in timerlat_top_main()
1090 top->start_time = time(NULL); in timerlat_top_main()
1094 sleep(params->sleep_time); in timerlat_top_main()
1096 if (params->aa_only && !trace_is_off(&top->trace, &record->trace)) in timerlat_top_main()
1099 retval = tracefs_iterate_raw_events(trace->tep, in timerlat_top_main()
1100 trace->inst, in timerlat_top_main()
1110 if (!params->quiet) in timerlat_top_main()
1113 if (trace_is_off(&top->trace, &record->trace)) in timerlat_top_main()
1116 /* is there still any user-threads ? */ in timerlat_top_main()
1117 if (params->user_workload) { in timerlat_top_main()
1125 if (params->user_workload && !params_u.stopped_running) { in timerlat_top_main()
1134 if (trace_is_off(&top->trace, &record->trace)) { in timerlat_top_main()
1137 if (!params->no_aa) in timerlat_top_main()
1138 timerlat_auto_analysis(params->stop_us, params->stop_total_us); in timerlat_top_main()
1140 if (params->trace_output) { in timerlat_top_main()
1141 printf(" Saving trace to %s\n", params->trace_output); in timerlat_top_main()
1142 save_trace_to_file(record->trace.inst, params->trace_output); in timerlat_top_main()
1144 } else if (params->aa_only) { in timerlat_top_main()
1146 * If the trace did not stop with --aa-only, at least print the in timerlat_top_main()
1149 max_lat = tracefs_instance_file_read(trace->inst, "tracing_max_latency", NULL); in timerlat_top_main()
1160 if (params->deepest_idle_state >= -1) { in timerlat_top_main()
1162 if (params->cpus && !CPU_ISSET(i, &params->monitored_cpus)) in timerlat_top_main()
1167 trace_events_destroy(&record->trace, params->events); in timerlat_top_main()
1168 params->events = NULL; in timerlat_top_main()
1170 timerlat_free_top(top->data); in timerlat_top_main()