Lines Matching +full:auto +full:- +full:sleep +full:- +full:disabled
1 // SPDX-License-Identifier: GPL-2.0
83 * timerlat_free_top - free runtime data
88 free(data->cpu_data); in timerlat_free_top()
93 * timerlat_alloc_histogram - alloc runtime data
104 data->nr_cpus = nr_cpus; in timerlat_alloc_top()
107 data->cpu_data = calloc(1, sizeof(*data->cpu_data) * nr_cpus); in timerlat_alloc_top()
108 if (!data->cpu_data) in timerlat_alloc_top()
113 data->cpu_data[cpu].min_irq = ~0; in timerlat_alloc_top()
114 data->cpu_data[cpu].min_thread = ~0; in timerlat_alloc_top()
115 data->cpu_data[cpu].min_user = ~0; in timerlat_alloc_top()
129 summary->min_irq = ~0; in timerlat_top_reset_sum()
130 summary->min_thread = ~0; in timerlat_top_reset_sum()
131 summary->min_user = ~0; in timerlat_top_reset_sum()
137 struct timerlat_top_data *data = tool->data; in timerlat_top_update_sum()
138 struct timerlat_top_cpu *cpu_data = &data->cpu_data[cpu]; in timerlat_top_update_sum()
140 sum->irq_count += cpu_data->irq_count; in timerlat_top_update_sum()
141 update_min(&sum->min_irq, &cpu_data->min_irq); in timerlat_top_update_sum()
142 update_sum(&sum->sum_irq, &cpu_data->sum_irq); in timerlat_top_update_sum()
143 update_max(&sum->max_irq, &cpu_data->max_irq); in timerlat_top_update_sum()
145 sum->thread_count += cpu_data->thread_count; in timerlat_top_update_sum()
146 update_min(&sum->min_thread, &cpu_data->min_thread); in timerlat_top_update_sum()
147 update_sum(&sum->sum_thread, &cpu_data->sum_thread); in timerlat_top_update_sum()
148 update_max(&sum->max_thread, &cpu_data->max_thread); in timerlat_top_update_sum()
150 sum->user_count += cpu_data->user_count; in timerlat_top_update_sum()
151 update_min(&sum->min_user, &cpu_data->min_user); in timerlat_top_update_sum()
152 update_sum(&sum->sum_user, &cpu_data->sum_user); in timerlat_top_update_sum()
153 update_max(&sum->max_user, &cpu_data->max_user); in timerlat_top_update_sum()
157 * timerlat_hist_update - record a new timerlat occurent on cpu, updating data
164 struct timerlat_top_data *data = tool->data; in timerlat_top_update()
165 struct timerlat_top_cpu *cpu_data = &data->cpu_data[cpu]; in timerlat_top_update()
168 cpu_data->irq_count++; in timerlat_top_update()
169 cpu_data->cur_irq = latency; in timerlat_top_update()
170 update_min(&cpu_data->min_irq, &latency); in timerlat_top_update()
171 update_sum(&cpu_data->sum_irq, &latency); in timerlat_top_update()
172 update_max(&cpu_data->max_irq, &latency); in timerlat_top_update()
174 cpu_data->thread_count++; in timerlat_top_update()
175 cpu_data->cur_thread = latency; in timerlat_top_update()
176 update_min(&cpu_data->min_thread, &latency); in timerlat_top_update()
177 update_sum(&cpu_data->sum_thread, &latency); in timerlat_top_update()
178 update_max(&cpu_data->max_thread, &latency); in timerlat_top_update()
180 cpu_data->user_count++; in timerlat_top_update()
181 cpu_data->cur_user = latency; in timerlat_top_update()
182 update_min(&cpu_data->min_user, &latency); in timerlat_top_update()
183 update_sum(&cpu_data->sum_user, &latency); in timerlat_top_update()
184 update_max(&cpu_data->max_user, &latency); in timerlat_top_update()
189 * timerlat_top_handler - this is the handler for timerlat tracer events
199 int cpu = record->cpu; in timerlat_top_handler()
202 params = top->params; in timerlat_top_handler()
204 if (!params->aa_only) { in timerlat_top_handler()
215 * timerlat_top_header - print the header of the tool output
219 struct trace_seq *s = top->trace.seq; in timerlat_top_header()
222 get_duration(top->start_time, duration, sizeof(duration)); in timerlat_top_header()
224 if (params->pretty_output) in timerlat_top_header()
228 if (params->user_top) in timerlat_top_header()
231 if (params->pretty_output) in timerlat_top_header()
235 …trace_seq_printf(s, "%-6s | IRQ Timer Latency (%s) | Thread Timer Latenc… in timerlat_top_header()
236 params->output_divisor == 1 ? "ns" : "us", in timerlat_top_header()
237 params->output_divisor == 1 ? "ns" : "us"); in timerlat_top_header()
239 if (params->user_top) { in timerlat_top_header()
241 params->output_divisor == 1 ? "ns" : "us"); in timerlat_top_header()
245 if (params->pretty_output) in timerlat_top_header()
249 if (params->user_top) in timerlat_top_header()
252 if (params->pretty_output) in timerlat_top_header()
257 static const char *no_value = " -";
260 * timerlat_top_print - prints the output of a given CPU
265 struct timerlat_top_params *params = top->params; in timerlat_top_print()
266 struct timerlat_top_data *data = top->data; in timerlat_top_print()
267 struct timerlat_top_cpu *cpu_data = &data->cpu_data[cpu]; in timerlat_top_print()
268 int divisor = params->output_divisor; in timerlat_top_print()
269 struct trace_seq *s = top->trace.seq; in timerlat_top_print()
277 if (!cpu_data->irq_count && !cpu_data->thread_count) in timerlat_top_print()
283 trace_seq_printf(s, "%3d #%-9d |", cpu, cpu_data->irq_count); in timerlat_top_print()
285 if (!cpu_data->irq_count) { in timerlat_top_print()
288 trace_seq_printf(s, "%9llu ", cpu_data->cur_irq / params->output_divisor); in timerlat_top_print()
289 trace_seq_printf(s, "%9llu ", cpu_data->min_irq / params->output_divisor); in timerlat_top_print()
290 trace_seq_printf(s, "%9llu ", (cpu_data->sum_irq / cpu_data->irq_count) / divisor); in timerlat_top_print()
291 trace_seq_printf(s, "%9llu |", cpu_data->max_irq / divisor); in timerlat_top_print()
294 if (!cpu_data->thread_count) { in timerlat_top_print()
297 trace_seq_printf(s, "%9llu ", cpu_data->cur_thread / divisor); in timerlat_top_print()
298 trace_seq_printf(s, "%9llu ", cpu_data->min_thread / divisor); in timerlat_top_print()
300 (cpu_data->sum_thread / cpu_data->thread_count) / divisor); in timerlat_top_print()
301 trace_seq_printf(s, "%9llu", cpu_data->max_thread / divisor); in timerlat_top_print()
304 if (!params->user_top) { in timerlat_top_print()
311 if (!cpu_data->user_count) { in timerlat_top_print()
314 trace_seq_printf(s, "%9llu ", cpu_data->cur_user / divisor); in timerlat_top_print()
315 trace_seq_printf(s, "%9llu ", cpu_data->min_user / divisor); in timerlat_top_print()
317 (cpu_data->sum_user / cpu_data->user_count) / divisor); in timerlat_top_print()
318 trace_seq_printf(s, "%9llu\n", cpu_data->max_user / divisor); in timerlat_top_print()
323 * timerlat_top_print_sum - prints the summary output
328 const char *split = "----------------------------------------"; in timerlat_top_print_sum()
329 struct timerlat_top_params *params = top->params; in timerlat_top_print_sum()
330 unsigned long long count = summary->irq_count; in timerlat_top_print_sum()
331 int divisor = params->output_divisor; in timerlat_top_print_sum()
332 struct trace_seq *s = top->trace.seq; in timerlat_top_print_sum()
341 if (!summary->irq_count && !summary->thread_count) in timerlat_top_print_sum()
350 if (params->user_top) in timerlat_top_print_sum()
351 trace_seq_printf(s, "-|%.*s", 39, split); in timerlat_top_print_sum()
354 trace_seq_printf(s, "ALL #%-6llu e%d |", count, e); in timerlat_top_print_sum()
356 if (!summary->irq_count) { in timerlat_top_print_sum()
360 trace_seq_printf(s, "%9llu ", summary->min_irq / params->output_divisor); in timerlat_top_print_sum()
361 trace_seq_printf(s, "%9llu ", (summary->sum_irq / summary->irq_count) / divisor); in timerlat_top_print_sum()
362 trace_seq_printf(s, "%9llu |", summary->max_irq / divisor); in timerlat_top_print_sum()
365 if (!summary->thread_count) { in timerlat_top_print_sum()
369 trace_seq_printf(s, "%9llu ", summary->min_thread / divisor); in timerlat_top_print_sum()
371 (summary->sum_thread / summary->thread_count) / divisor); in timerlat_top_print_sum()
372 trace_seq_printf(s, "%9llu", summary->max_thread / divisor); in timerlat_top_print_sum()
375 if (!params->user_top) { in timerlat_top_print_sum()
382 if (!summary->user_count) { in timerlat_top_print_sum()
386 trace_seq_printf(s, "%9llu ", summary->min_user / divisor); in timerlat_top_print_sum()
388 (summary->sum_user / summary->user_count) / divisor); in timerlat_top_print_sum()
389 trace_seq_printf(s, "%9llu\n", summary->max_user / divisor); in timerlat_top_print_sum()
394 * clear_terminal - clears the output terminal
403 * timerlat_print_stats - print data for all cpus
408 struct trace_instance *trace = &top->trace; in timerlat_print_stats()
410 static int nr_cpus = -1; in timerlat_print_stats()
413 if (params->aa_only) in timerlat_print_stats()
416 if (nr_cpus == -1) in timerlat_print_stats()
419 if (!params->quiet) in timerlat_print_stats()
420 clear_terminal(trace->seq); in timerlat_print_stats()
427 if (params->cpus && !CPU_ISSET(i, ¶ms->monitored_cpus)) in timerlat_print_stats()
435 trace_seq_do_printf(trace->seq); in timerlat_print_stats()
436 trace_seq_reset(trace->seq); in timerlat_print_stats()
440 * timerlat_top_usage - prints timerlat top usage message
448 …" usage: rtla timerlat [top] [-h] [-q] [-a us] [-d s] [-D] [-n] [-p us] [-i us] [-T us] [-s us] \… in timerlat_top_usage()
449 …" [[-t[file]] [-e sys[:event]] [--filter <filter>] [--trigger <trigger>] [-c cpu-list] [-H cpu-l… in timerlat_top_usage()
450 " [-P priority] [--dma-latency us] [--aa-only us] [-C[=cgroup_name]] [-u|-k] [--warm-up s]", in timerlat_top_usage()
452 " -h/--help: print this menu", in timerlat_top_usage()
453 " -a/--auto: set automatic trace mode, stopping the session if argument in us latency is hit", in timerlat_top_usage()
454 …" --aa-only us: stop if <us> latency is hit, only printing the auto analysis (reduces CPU usa… in timerlat_top_usage()
455 " -p/--period us: timerlat period in us", in timerlat_top_usage()
456 " -i/--irq us: stop trace if the irq latency is higher than the argument in us", in timerlat_top_usage()
457 " -T/--thread us: stop trace if the thread latency is higher than the argument in us", in timerlat_top_usage()
458 …" -s/--stack us: save the stack trace at the IRQ if a thread latency is higher than the argument… in timerlat_top_usage()
459 " -c/--cpus cpus: run the tracer only on the given cpus", in timerlat_top_usage()
460 " -H/--house-keeping cpus: run rtla control threads only on the given cpus", in timerlat_top_usage()
461 …" -C/--cgroup[=cgroup_name]: set cgroup, if no cgroup_name is passed, the rtla's cgroup will be … in timerlat_top_usage()
462 " -d/--duration time[s|m|h|d]: duration of the session", in timerlat_top_usage()
463 " -D/--debug: print debug info", in timerlat_top_usage()
464 …" --dump-tasks: prints the task running on all CPUs if stop conditions are met (depends on !-… in timerlat_top_usage()
465 " -t/--trace[file]: save the stopped trace to [file|timerlat_trace.txt]", in timerlat_top_usage()
466 …" -e/--event <sys:event>: enable the <sys:event> in the trace instance, multiple -e are allowed", in timerlat_top_usage()
467 " --filter <command>: enable a trace event filter to the previous -e event", in timerlat_top_usage()
468 " --trigger <command>: enable a trace event trigger to the previous -e event", in timerlat_top_usage()
469 " -n/--nano: display data in nanoseconds", in timerlat_top_usage()
470 " --no-aa: disable auto-analysis, reducing rtla timerlat cpu usage", in timerlat_top_usage()
471 " -q/--quiet print only a summary at the end", in timerlat_top_usage()
472 " --dma-latency us: set /dev/cpu_dma_latency latency <us> to reduce exit from idle latency", in timerlat_top_usage()
473 " -P/--priority o:prio|r:prio|f:prio|d:runtime:period : set scheduling parameters", in timerlat_top_usage()
474 " o:prio - use SCHED_OTHER with prio", in timerlat_top_usage()
475 " r:prio - use SCHED_RR with prio", in timerlat_top_usage()
476 " f:prio - use SCHED_FIFO with prio", in timerlat_top_usage()
477 " d:runtime[us|ms|s]:period[us|ms|s] - use SCHED_DEADLINE with runtime and period", in timerlat_top_usage()
479 " -u/--user-threads: use rtla user-space threads instead of kernel-space timerlat threads", in timerlat_top_usage()
480 " -k/--kernel-threads: use timerlat kernel-space threads instead of rtla user-space threads", in timerlat_top_usage()
481 " -U/--user-load: enable timerlat for user-defined user-space workload", in timerlat_top_usage()
482 " --warm-up s: let the workload run for s seconds before collecting data", in timerlat_top_usage()
483 " --trace-buffer-size kB: set the per-cpu trace buffer size in kB", in timerlat_top_usage()
490 fprintf(stderr, "rtla timerlat top: a per-cpu summary of the timer latency (version %s)\n", in timerlat_top_usage()
503 * timerlat_top_parse_args - allocs, parse and fill the cmd line parameters
518 /* disabled by default */ in timerlat_top_parse_args()
519 params->dma_latency = -1; in timerlat_top_parse_args()
522 params->output_divisor = 1000; in timerlat_top_parse_args()
526 {"auto", required_argument, 0, 'a'}, in timerlat_top_parse_args()
533 {"house-keeping", required_argument, 0, 'H'}, in timerlat_top_parse_args()
542 {"user-threads", no_argument, 0, 'u'}, in timerlat_top_parse_args()
543 {"kernel-threads", no_argument, 0, 'k'}, in timerlat_top_parse_args()
544 {"user-load", no_argument, 0, 'U'}, in timerlat_top_parse_args()
547 {"dma-latency", required_argument, 0, '2'}, in timerlat_top_parse_args()
548 {"no-aa", no_argument, 0, '3'}, in timerlat_top_parse_args()
549 {"dump-tasks", no_argument, 0, '4'}, in timerlat_top_parse_args()
550 {"aa-only", required_argument, 0, '5'}, in timerlat_top_parse_args()
551 {"warm-up", required_argument, 0, '6'}, in timerlat_top_parse_args()
552 {"trace-buffer-size", required_argument, 0, '7'}, in timerlat_top_parse_args()
563 if (c == -1) in timerlat_top_parse_args()
571 params->stop_total_us = auto_thresh; in timerlat_top_parse_args()
572 params->stop_us = auto_thresh; in timerlat_top_parse_args()
575 params->print_stack = auto_thresh; in timerlat_top_parse_args()
578 params->trace_output = "timerlat_trace.txt"; in timerlat_top_parse_args()
581 /* it is here because it is similar to -a */ in timerlat_top_parse_args()
585 params->stop_total_us = auto_thresh; in timerlat_top_parse_args()
586 params->stop_us = auto_thresh; in timerlat_top_parse_args()
589 params->print_stack = auto_thresh; in timerlat_top_parse_args()
592 params->aa_only = 1; in timerlat_top_parse_args()
595 retval = parse_cpu_set(optarg, ¶ms->monitored_cpus); in timerlat_top_parse_args()
597 timerlat_top_usage("\nInvalid -c cpu list\n"); in timerlat_top_parse_args()
598 params->cpus = optarg; in timerlat_top_parse_args()
601 params->cgroup = 1; in timerlat_top_parse_args()
604 params->cgroup_name = NULL; in timerlat_top_parse_args()
607 params->cgroup_name = ++optarg; in timerlat_top_parse_args()
614 params->duration = parse_seconds_duration(optarg); in timerlat_top_parse_args()
615 if (!params->duration) in timerlat_top_parse_args()
616 timerlat_top_usage("Invalid -d duration\n"); in timerlat_top_parse_args()
625 if (params->events) in timerlat_top_parse_args()
626 tevent->next = params->events; in timerlat_top_parse_args()
627 params->events = tevent; in timerlat_top_parse_args()
634 params->hk_cpus = 1; in timerlat_top_parse_args()
635 retval = parse_cpu_set(optarg, ¶ms->hk_cpu_set); in timerlat_top_parse_args()
642 params->stop_us = get_llong_from_str(optarg); in timerlat_top_parse_args()
645 params->kernel_workload = true; in timerlat_top_parse_args()
648 params->output_divisor = 1; in timerlat_top_parse_args()
651 params->timerlat_period_us = get_llong_from_str(optarg); in timerlat_top_parse_args()
652 if (params->timerlat_period_us > 1000000) in timerlat_top_parse_args()
656 retval = parse_prio(optarg, ¶ms->sched_param); in timerlat_top_parse_args()
657 if (retval == -1) in timerlat_top_parse_args()
658 timerlat_top_usage("Invalid -P priority"); in timerlat_top_parse_args()
659 params->set_sched = 1; in timerlat_top_parse_args()
662 params->quiet = 1; in timerlat_top_parse_args()
665 params->print_stack = get_llong_from_str(optarg); in timerlat_top_parse_args()
668 params->stop_total_us = get_llong_from_str(optarg); in timerlat_top_parse_args()
673 params->trace_output = &optarg[1]; in timerlat_top_parse_args()
675 params->trace_output = &optarg[0]; in timerlat_top_parse_args()
676 } else if (optind < argc && argv[optind][0] != '-') in timerlat_top_parse_args()
677 params->trace_output = argv[optind]; in timerlat_top_parse_args()
679 params->trace_output = "timerlat_trace.txt"; in timerlat_top_parse_args()
683 params->user_workload = true; in timerlat_top_parse_args()
684 /* fallback: -u implies -U */ in timerlat_top_parse_args()
686 params->user_top = true; in timerlat_top_parse_args()
689 if (params->events) { in timerlat_top_parse_args()
690 retval = trace_event_add_trigger(params->events, optarg); in timerlat_top_parse_args()
696 timerlat_top_usage("--trigger requires a previous -e\n"); in timerlat_top_parse_args()
700 if (params->events) { in timerlat_top_parse_args()
701 retval = trace_event_add_filter(params->events, optarg); in timerlat_top_parse_args()
707 timerlat_top_usage("--filter requires a previous -e\n"); in timerlat_top_parse_args()
710 case '2': /* dma-latency */ in timerlat_top_parse_args()
711 params->dma_latency = get_llong_from_str(optarg); in timerlat_top_parse_args()
712 if (params->dma_latency < 0 || params->dma_latency > 10000) { in timerlat_top_parse_args()
713 err_msg("--dma-latency needs to be >= 0 and < 10000"); in timerlat_top_parse_args()
717 case '3': /* no-aa */ in timerlat_top_parse_args()
718 params->no_aa = 1; in timerlat_top_parse_args()
721 params->dump_tasks = 1; in timerlat_top_parse_args()
724 params->warmup = get_llong_from_str(optarg); in timerlat_top_parse_args()
727 params->buffer_size = get_llong_from_str(optarg); in timerlat_top_parse_args()
740 * Auto analysis only happens if stop tracing, thus: in timerlat_top_parse_args()
742 if (!params->stop_us && !params->stop_total_us) in timerlat_top_parse_args()
743 params->no_aa = 1; in timerlat_top_parse_args()
745 if (params->no_aa && params->aa_only) in timerlat_top_parse_args()
746 timerlat_top_usage("--no-aa and --aa-only are mutually exclusive!"); in timerlat_top_parse_args()
748 if (params->kernel_workload && params->user_workload) in timerlat_top_parse_args()
749 timerlat_top_usage("--kernel-threads and --user-threads are mutually exclusive!"); in timerlat_top_parse_args()
755 * timerlat_top_apply_config - apply the top configs to the initialized tool
763 if (!params->sleep_time) in timerlat_top_apply_config()
764 params->sleep_time = 1; in timerlat_top_apply_config()
766 if (params->cpus) { in timerlat_top_apply_config()
767 retval = osnoise_set_cpus(top->context, params->cpus); in timerlat_top_apply_config()
774 CPU_SET(i, ¶ms->monitored_cpus); in timerlat_top_apply_config()
777 if (params->stop_us) { in timerlat_top_apply_config()
778 retval = osnoise_set_stop_us(top->context, params->stop_us); in timerlat_top_apply_config()
785 if (params->stop_total_us) { in timerlat_top_apply_config()
786 retval = osnoise_set_stop_total_us(top->context, params->stop_total_us); in timerlat_top_apply_config()
794 if (params->timerlat_period_us) { in timerlat_top_apply_config()
795 retval = osnoise_set_timerlat_period_us(top->context, params->timerlat_period_us); in timerlat_top_apply_config()
803 if (params->print_stack) { in timerlat_top_apply_config()
804 retval = osnoise_set_print_stack(top->context, params->print_stack); in timerlat_top_apply_config()
811 if (params->hk_cpus) { in timerlat_top_apply_config()
812 retval = sched_setaffinity(getpid(), sizeof(params->hk_cpu_set), in timerlat_top_apply_config()
813 ¶ms->hk_cpu_set); in timerlat_top_apply_config()
814 if (retval == -1) { in timerlat_top_apply_config()
818 } else if (params->cpus) { in timerlat_top_apply_config()
820 * Even if the user do not set a house-keeping CPU, try to in timerlat_top_apply_config()
826 auto_house_keeping(¶ms->monitored_cpus); in timerlat_top_apply_config()
830 * If the user did not specify a type of thread, try user-threads first. in timerlat_top_apply_config()
833 if (!params->kernel_workload && !params->user_workload) { in timerlat_top_apply_config()
836 debug_msg("User-space interface detected, setting user-threads\n"); in timerlat_top_apply_config()
837 params->user_workload = 1; in timerlat_top_apply_config()
838 params->user_top = 1; in timerlat_top_apply_config()
840 debug_msg("User-space interface not detected, setting kernel-threads\n"); in timerlat_top_apply_config()
841 params->kernel_workload = 1; in timerlat_top_apply_config()
845 if (params->user_top) { in timerlat_top_apply_config()
846 retval = osnoise_set_workload(top->context, 0); in timerlat_top_apply_config()
853 if (isatty(1) && !params->quiet) in timerlat_top_apply_config()
854 params->pretty_output = 1; in timerlat_top_apply_config()
859 return -1; in timerlat_top_apply_config()
863 * timerlat_init_top - initialize a timerlat top tool with parameters
877 top->data = timerlat_alloc_top(nr_cpus); in timerlat_init_top()
878 if (!top->data) in timerlat_init_top()
881 top->params = params; in timerlat_init_top()
883 tep_register_event_handler(top->trace.tep, -1, "ftrace", "timerlat", in timerlat_init_top()
900 * timerlat_top_set_signals - handles the signal to stop the tool
906 if (params->duration) { in timerlat_top_set_signals()
908 alarm(params->duration); in timerlat_top_set_signals()
920 int dma_latency_fd = -1; in timerlat_top_main()
942 trace = &top->trace; in timerlat_top_main()
950 if (params->set_sched) { in timerlat_top_main()
951 retval = set_comm_sched_attr("timerlat/", ¶ms->sched_param); in timerlat_top_main()
958 if (params->cgroup && !params->user_top) { in timerlat_top_main()
959 retval = set_comm_cgroup("timerlat/", params->cgroup_name); in timerlat_top_main()
966 if (params->dma_latency >= 0) { in timerlat_top_main()
967 dma_latency_fd = set_cpu_dma_latency(params->dma_latency); in timerlat_top_main()
974 if (params->trace_output) { in timerlat_top_main()
981 if (params->events) { in timerlat_top_main()
982 retval = trace_events_enable(&record->trace, params->events); in timerlat_top_main()
987 if (params->buffer_size > 0) { in timerlat_top_main()
988 retval = trace_set_buffer_size(&record->trace, params->buffer_size); in timerlat_top_main()
994 if (!params->no_aa) { in timerlat_top_main()
995 if (params->aa_only) { in timerlat_top_main()
1005 retval = timerlat_aa_init(aa, params->dump_tasks); in timerlat_top_main()
1007 err_msg("Failed to enable the auto analysis instance\n"); in timerlat_top_main()
1011 /* if it is re-using the main instance, there is no need to start it */ in timerlat_top_main()
1013 retval = enable_timerlat(&aa->trace); in timerlat_top_main()
1021 if (params->user_workload) { in timerlat_top_main()
1027 params_u.set = ¶ms->monitored_cpus; in timerlat_top_main()
1028 if (params->set_sched) in timerlat_top_main()
1029 params_u.sched_param = ¶ms->sched_param; in timerlat_top_main()
1033 params_u.cgroup_name = params->cgroup_name; in timerlat_top_main()
1037 err_msg("Error creating timerlat user-space threads\n"); in timerlat_top_main()
1040 if (params->warmup > 0) { in timerlat_top_main()
1041 debug_msg("Warming up for %d seconds\n", params->warmup); in timerlat_top_main()
1042 sleep(params->warmup); in timerlat_top_main()
1052 if (params->trace_output) in timerlat_top_main()
1053 trace_instance_start(&record->trace); in timerlat_top_main()
1054 if (!params->no_aa && aa != top) in timerlat_top_main()
1055 trace_instance_start(&aa->trace); in timerlat_top_main()
1058 top->start_time = time(NULL); in timerlat_top_main()
1062 sleep(params->sleep_time); in timerlat_top_main()
1064 if (params->aa_only && !trace_is_off(&top->trace, &record->trace)) in timerlat_top_main()
1067 retval = tracefs_iterate_raw_events(trace->tep, in timerlat_top_main()
1068 trace->inst, in timerlat_top_main()
1078 if (!params->quiet) in timerlat_top_main()
1081 if (trace_is_off(&top->trace, &record->trace)) in timerlat_top_main()
1084 /* is there still any user-threads ? */ in timerlat_top_main()
1085 if (params->user_workload) { in timerlat_top_main()
1093 if (params->user_workload && !params_u.stopped_running) { in timerlat_top_main()
1095 sleep(1); in timerlat_top_main()
1102 if (trace_is_off(&top->trace, &record->trace)) { in timerlat_top_main()
1105 if (!params->no_aa) in timerlat_top_main()
1106 timerlat_auto_analysis(params->stop_us, params->stop_total_us); in timerlat_top_main()
1108 if (params->trace_output) { in timerlat_top_main()
1109 printf(" Saving trace to %s\n", params->trace_output); in timerlat_top_main()
1110 save_trace_to_file(record->trace.inst, params->trace_output); in timerlat_top_main()
1112 } else if (params->aa_only) { in timerlat_top_main()
1114 * If the trace did not stop with --aa-only, at least print the in timerlat_top_main()
1117 max_lat = tracefs_instance_file_read(trace->inst, "tracing_max_latency", NULL); in timerlat_top_main()
1128 trace_events_destroy(&record->trace, params->events); in timerlat_top_main()
1129 params->events = NULL; in timerlat_top_main()
1131 timerlat_free_top(top->data); in timerlat_top_main()