Lines Matching +full:exit +full:- +full:latency +full:- +full:us
1 // SPDX-License-Identifier: GPL-2.0
22 * Per-cpu data statistics and data.
28 /* timerlat IRQ latency */
33 /* timerlat Thread latency */
63 * If now - timestamp is <= latency, it might have influenced
64 * in the timerlat irq latency. Otherwise, ignore it.
134 * timerlat_aa_get_data - Get the per-cpu data from the timerlat context
139 return &taa_ctx->taa_data[cpu]; in timerlat_aa_get_data()
143 * timerlat_aa_irq_latency - Handles timerlat IRQ event
153 taa_data->curr_state = TIMERLAT_WAITING_THREAD; in timerlat_aa_irq_latency()
154 taa_data->tlat_irq_timstamp = record->ts; in timerlat_aa_irq_latency()
159 taa_data->thread_nmi_sum = 0; in timerlat_aa_irq_latency()
160 taa_data->thread_irq_sum = 0; in timerlat_aa_irq_latency()
161 taa_data->thread_softirq_sum = 0; in timerlat_aa_irq_latency()
162 taa_data->thread_thread_sum = 0; in timerlat_aa_irq_latency()
163 taa_data->thread_blocking_duration = 0; in timerlat_aa_irq_latency()
164 taa_data->timer_irq_start_time = 0; in timerlat_aa_irq_latency()
165 taa_data->timer_irq_duration = 0; in timerlat_aa_irq_latency()
166 taa_data->timer_exit_from_idle = 0; in timerlat_aa_irq_latency()
171 trace_seq_reset(taa_data->nmi_seq); in timerlat_aa_irq_latency()
172 trace_seq_reset(taa_data->irqs_seq); in timerlat_aa_irq_latency()
173 trace_seq_reset(taa_data->softirqs_seq); in timerlat_aa_irq_latency()
174 trace_seq_reset(taa_data->threads_seq); in timerlat_aa_irq_latency()
176 /* IRQ latency values */ in timerlat_aa_irq_latency()
177 tep_get_field_val(s, event, "timer_latency", record, &taa_data->tlat_irq_latency, 1); in timerlat_aa_irq_latency()
178 tep_get_field_val(s, event, "seqnum", record, &taa_data->tlat_irq_seqnum, 1); in timerlat_aa_irq_latency()
181 tep_get_common_field_val(s, event, "common_pid", record, &taa_data->run_thread_pid, 1); in timerlat_aa_irq_latency()
184 * Get exit from idle case. in timerlat_aa_irq_latency()
188 if (taa_data->run_thread_pid) in timerlat_aa_irq_latency()
192 * if the latency is shorter than the known exit from idle: in timerlat_aa_irq_latency()
194 if (taa_data->tlat_irq_latency < taa_data->max_exit_idle_latency) in timerlat_aa_irq_latency()
201 if (taa_data->tlat_irq_timstamp - taa_data->tlat_irq_latency in timerlat_aa_irq_latency()
202 < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) in timerlat_aa_irq_latency()
205 taa_data->max_exit_idle_latency = taa_data->tlat_irq_latency; in timerlat_aa_irq_latency()
211 * timerlat_aa_thread_latency - Handles timerlat thread event
221 taa_data->curr_state = TIMERLAT_WAITING_IRQ; in timerlat_aa_thread_latency()
222 taa_data->tlat_thread_timstamp = record->ts; in timerlat_aa_thread_latency()
224 /* Thread latency values */ in timerlat_aa_thread_latency()
225 tep_get_field_val(s, event, "timer_latency", record, &taa_data->tlat_thread_latency, 1); in timerlat_aa_thread_latency()
226 tep_get_field_val(s, event, "seqnum", record, &taa_data->tlat_thread_seqnum, 1); in timerlat_aa_thread_latency()
232 * timerlat_aa_handler - Handle timerlat events
236 * Returns 0 on success, -1 otherwise.
242 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_handler()
246 return -1; in timerlat_aa_handler()
256 * timerlat_aa_nmi_handler - Handles NMI noise
265 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_nmi_handler()
272 if (taa_data->curr_state == TIMERLAT_WAITING_IRQ) { in timerlat_aa_nmi_handler()
273 taa_data->prev_irq_duration = duration; in timerlat_aa_nmi_handler()
274 taa_data->prev_irq_timstamp = start; in timerlat_aa_nmi_handler()
276 trace_seq_reset(taa_data->prev_irqs_seq); in timerlat_aa_nmi_handler()
277 trace_seq_printf(taa_data->prev_irqs_seq, "\t%24s \t\t\t%9.2f us\n", in timerlat_aa_nmi_handler()
282 taa_data->thread_nmi_sum += duration; in timerlat_aa_nmi_handler()
283 trace_seq_printf(taa_data->nmi_seq, " %24s \t\t\t%9.2f us\n", in timerlat_aa_nmi_handler()
290 * timerlat_aa_irq_handler - Handles IRQ noise
296 * - The IRQs that can delay the timer IRQ before it happened.
297 * - The Timerlat IRQ handler
298 * - The IRQs that happened between the timerlat IRQ and the timerlat thread
305 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_irq_handler()
321 if (taa_data->curr_state == TIMERLAT_WAITING_IRQ) { in timerlat_aa_irq_handler()
322 taa_data->prev_irq_duration = duration; in timerlat_aa_irq_handler()
323 taa_data->prev_irq_timstamp = start; in timerlat_aa_irq_handler()
325 trace_seq_reset(taa_data->prev_irqs_seq); in timerlat_aa_irq_handler()
326 trace_seq_printf(taa_data->prev_irqs_seq, "\t%24s:%-3llu \t\t%9.2f us\n", in timerlat_aa_irq_handler()
332 * The timerlat IRQ: taa_data->timer_irq_start_time is zeroed at in timerlat_aa_irq_handler()
335 if (!taa_data->timer_irq_start_time) { in timerlat_aa_irq_handler()
336 expected_start = taa_data->tlat_irq_timstamp - taa_data->tlat_irq_latency; in timerlat_aa_irq_handler()
338 taa_data->timer_irq_start_time = start; in timerlat_aa_irq_handler()
339 taa_data->timer_irq_duration = duration; in timerlat_aa_irq_handler()
354 if (expected_start < taa_data->timer_irq_start_time) in timerlat_aa_irq_handler()
355 taa_data->timer_irq_start_delay = taa_data->timer_irq_start_time - expected_start; in timerlat_aa_irq_handler()
357 taa_data->timer_irq_start_delay = 0; in timerlat_aa_irq_handler()
360 * not exit from idle. in timerlat_aa_irq_handler()
362 if (taa_data->run_thread_pid) in timerlat_aa_irq_handler()
365 if (expected_start > taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) in timerlat_aa_irq_handler()
366 taa_data->timer_exit_from_idle = taa_data->timer_irq_start_delay; in timerlat_aa_irq_handler()
374 taa_data->thread_irq_sum += duration; in timerlat_aa_irq_handler()
375 trace_seq_printf(taa_data->irqs_seq, " %24s:%-3llu \t %9.2f us\n", in timerlat_aa_irq_handler()
386 * timerlat_aa_softirq_handler - Handles Softirq noise
391 * It is only printed in the non-rt kernel, as softirqs become thread on RT.
397 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_softirq_handler()
402 if (taa_data->curr_state == TIMERLAT_WAITING_IRQ) in timerlat_aa_softirq_handler()
409 taa_data->thread_softirq_sum += duration; in timerlat_aa_softirq_handler()
411 trace_seq_printf(taa_data->softirqs_seq, "\t%24s:%-3llu \t %9.2f us\n", in timerlat_aa_softirq_handler()
417 * timerlat_aa_softirq_handler - Handles thread noise
428 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_thread_handler()
435 if (taa_data->curr_state == TIMERLAT_WAITING_IRQ) in timerlat_aa_thread_handler()
444 if (pid == taa_data->run_thread_pid && !taa_data->thread_blocking_duration) { in timerlat_aa_thread_handler()
445 taa_data->thread_blocking_duration = duration; in timerlat_aa_thread_handler()
448 strncpy(taa_data->run_thread_comm, comm, MAX_COMM); in timerlat_aa_thread_handler()
450 sprintf(taa_data->run_thread_comm, "<...>"); in timerlat_aa_thread_handler()
453 taa_data->thread_thread_sum += duration; in timerlat_aa_thread_handler()
455 trace_seq_printf(taa_data->threads_seq, "\t%24s:%-3llu \t\t%9.2f us\n", in timerlat_aa_thread_handler()
463 * timerlat_aa_stack_handler - Handles timerlat IRQ stack trace
471 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_stack_handler()
476 trace_seq_reset(taa_data->stack_seq); in timerlat_aa_stack_handler()
478 trace_seq_printf(taa_data->stack_seq, " Blocking thread stack trace\n"); in timerlat_aa_stack_handler()
482 function = tep_find_function(taa_ctx->tool->trace.tep, caller[i]); in timerlat_aa_stack_handler()
485 trace_seq_printf(taa_data->stack_seq, "\t\t-> %s\n", function); in timerlat_aa_stack_handler()
492 * timerlat_aa_sched_switch_handler - Tracks the current thread running on the CPU
502 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_sched_switch_handler()
506 tep_get_field_val(s, event, "next_pid", record, &taa_data->current_pid, 1); in timerlat_aa_sched_switch_handler()
509 strncpy(taa_data->current_comm, comm, MAX_COMM); in timerlat_aa_sched_switch_handler()
514 taa_data->kworker = 0; in timerlat_aa_sched_switch_handler()
515 taa_data->kworker_func = 0; in timerlat_aa_sched_switch_handler()
521 * timerlat_aa_kworker_start_handler - Tracks a kworker running on the CPU
533 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_kworker_start_handler()
535 tep_get_field_val(s, event, "work", record, &taa_data->kworker, 1); in timerlat_aa_kworker_start_handler()
536 tep_get_field_val(s, event, "function", record, &taa_data->kworker_func, 1); in timerlat_aa_kworker_start_handler()
541 * timerlat_thread_analysis - Prints the analysis of a CPU that hit a stop tracing
553 * IRQ latency or Thread latency? in timerlat_thread_analysis()
555 if (taa_data->tlat_irq_seqnum > taa_data->tlat_thread_seqnum) { in timerlat_thread_analysis()
557 total = taa_data->tlat_irq_latency; in timerlat_thread_analysis()
560 total = taa_data->tlat_thread_latency; in timerlat_thread_analysis()
568 exp_irq_ts = taa_data->timer_irq_start_time - taa_data->timer_irq_start_delay; in timerlat_thread_analysis()
569 if (exp_irq_ts < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) { in timerlat_thread_analysis()
570 if (taa_data->prev_irq_timstamp < taa_data->timer_irq_start_time) in timerlat_thread_analysis()
571 printf(" Previous IRQ interference: \t\t up to %9.2f us\n", in timerlat_thread_analysis()
572 ns_to_usf(taa_data->prev_irq_duration)); in timerlat_thread_analysis()
578 printf(" IRQ handler delay: %16s %9.2f us (%.2f %%)\n", in timerlat_thread_analysis()
579 (ns_to_usf(taa_data->timer_exit_from_idle) > 10) ? "(exit from idle)" : "", in timerlat_thread_analysis()
580 ns_to_usf(taa_data->timer_irq_start_delay), in timerlat_thread_analysis()
581 ns_to_per(total, taa_data->timer_irq_start_delay)); in timerlat_thread_analysis()
586 printf(" IRQ latency: \t\t\t\t %9.2f us\n", in timerlat_thread_analysis()
587 ns_to_usf(taa_data->tlat_irq_latency)); in timerlat_thread_analysis()
592 * because... the trace stopped :-). in timerlat_thread_analysis()
598 printf(" %24s:%-9llu\n", in timerlat_thread_analysis()
599 taa_data->run_thread_comm, taa_data->run_thread_pid); in timerlat_thread_analysis()
604 printf(" Timerlat IRQ duration: \t\t %9.2f us (%.2f %%)\n", in timerlat_thread_analysis()
605 ns_to_usf(taa_data->timer_irq_duration), in timerlat_thread_analysis()
606 ns_to_per(total, taa_data->timer_irq_duration)); in timerlat_thread_analysis()
614 printf(" Blocking thread: \t\t\t %9.2f us (%.2f %%)\n", in timerlat_thread_analysis()
615 ns_to_usf(taa_data->thread_blocking_duration), in timerlat_thread_analysis()
616 ns_to_per(total, taa_data->thread_blocking_duration)); in timerlat_thread_analysis()
618 printf(" %24s:%-9llu %9.2f us\n", in timerlat_thread_analysis()
619 taa_data->run_thread_comm, taa_data->run_thread_pid, in timerlat_thread_analysis()
620 ns_to_usf(taa_data->thread_blocking_duration)); in timerlat_thread_analysis()
626 trace_seq_do_printf(taa_data->stack_seq); in timerlat_thread_analysis()
631 if (taa_data->thread_nmi_sum) in timerlat_thread_analysis()
632 printf(" NMI interference \t\t\t %9.2f us (%.2f %%)\n", in timerlat_thread_analysis()
633 ns_to_usf(taa_data->thread_nmi_sum), in timerlat_thread_analysis()
634 ns_to_per(total, taa_data->thread_nmi_sum)); in timerlat_thread_analysis()
637 * If it is an IRQ latency, the other factors can be skipped. in timerlat_thread_analysis()
643 * Prints the interference caused by IRQs to the thread latency. in timerlat_thread_analysis()
645 if (taa_data->thread_irq_sum) { in timerlat_thread_analysis()
646 printf(" IRQ interference \t\t\t %9.2f us (%.2f %%)\n", in timerlat_thread_analysis()
647 ns_to_usf(taa_data->thread_irq_sum), in timerlat_thread_analysis()
648 ns_to_per(total, taa_data->thread_irq_sum)); in timerlat_thread_analysis()
650 trace_seq_do_printf(taa_data->irqs_seq); in timerlat_thread_analysis()
654 * Prints the interference caused by Softirqs to the thread latency. in timerlat_thread_analysis()
656 if (taa_data->thread_softirq_sum) { in timerlat_thread_analysis()
657 printf(" Softirq interference \t\t\t %9.2f us (%.2f %%)\n", in timerlat_thread_analysis()
658 ns_to_usf(taa_data->thread_softirq_sum), in timerlat_thread_analysis()
659 ns_to_per(total, taa_data->thread_softirq_sum)); in timerlat_thread_analysis()
661 trace_seq_do_printf(taa_data->softirqs_seq); in timerlat_thread_analysis()
665 * Prints the interference caused by other threads to the thread latency. in timerlat_thread_analysis()
669 * latency" only, and here is the difference from scheduling latency and in timerlat_thread_analysis()
670 * timer handling latency. in timerlat_thread_analysis()
672 if (taa_data->thread_thread_sum) { in timerlat_thread_analysis()
673 printf(" Thread interference \t\t\t %9.2f us (%.2f %%)\n", in timerlat_thread_analysis()
674 ns_to_usf(taa_data->thread_thread_sum), in timerlat_thread_analysis()
675 ns_to_per(total, taa_data->thread_thread_sum)); in timerlat_thread_analysis()
677 trace_seq_do_printf(taa_data->threads_seq); in timerlat_thread_analysis()
684 printf("------------------------------------------------------------------------\n"); in timerlat_thread_analysis()
685 printf(" %s latency: \t\t\t %9.2f us (100%%)\n", irq ? "IRQ" : "Thread", in timerlat_thread_analysis()
691 struct trace_instance *trace = &taa_ctx->tool->trace; in timerlat_auto_analysis_collect_trace()
694 retval = tracefs_iterate_raw_events(trace->tep, in timerlat_auto_analysis_collect_trace()
695 trace->inst, in timerlat_auto_analysis_collect_trace()
709 * timerlat_auto_analysis - Analyze the collected data
726 for (cpu = 0; cpu < taa_ctx->nr_cpus; cpu++) { in timerlat_auto_analysis()
729 if (irq_thresh && taa_data->tlat_irq_latency >= irq_thresh) { in timerlat_auto_analysis()
732 } else if (thread_thresh && (taa_data->tlat_thread_latency) >= thread_thresh) { in timerlat_auto_analysis()
737 if (taa_data->max_exit_idle_latency > max_exit_from_idle) { in timerlat_auto_analysis()
738 max_exit_from_idle = taa_data->max_exit_idle_latency; in timerlat_auto_analysis()
746 printf("Max timerlat IRQ latency from idle: %.2f us in cpu %d\n", in timerlat_auto_analysis()
749 if (!taa_ctx->dump_tasks) in timerlat_auto_analysis()
754 for (cpu = 0; cpu < taa_ctx->nr_cpus; cpu++) { in timerlat_auto_analysis()
756 tep = taa_ctx->tool->trace.tep; in timerlat_auto_analysis()
758 printf(" [%.3d] %24s:%llu", cpu, taa_data->current_comm, taa_data->current_pid); in timerlat_auto_analysis()
760 if (taa_data->kworker_func) in timerlat_auto_analysis()
762 tep_find_function(tep, taa_data->kworker) ? : "<...>", in timerlat_auto_analysis()
763 tep_find_function(tep, taa_data->kworker_func)); in timerlat_auto_analysis()
770 * timerlat_aa_destroy_seqs - Destroy seq files used to store parsed data
777 if (!taa_ctx->taa_data) in timerlat_aa_destroy_seqs()
780 for (i = 0; i < taa_ctx->nr_cpus; i++) { in timerlat_aa_destroy_seqs()
783 if (taa_data->prev_irqs_seq) { in timerlat_aa_destroy_seqs()
784 trace_seq_destroy(taa_data->prev_irqs_seq); in timerlat_aa_destroy_seqs()
785 free(taa_data->prev_irqs_seq); in timerlat_aa_destroy_seqs()
788 if (taa_data->nmi_seq) { in timerlat_aa_destroy_seqs()
789 trace_seq_destroy(taa_data->nmi_seq); in timerlat_aa_destroy_seqs()
790 free(taa_data->nmi_seq); in timerlat_aa_destroy_seqs()
793 if (taa_data->irqs_seq) { in timerlat_aa_destroy_seqs()
794 trace_seq_destroy(taa_data->irqs_seq); in timerlat_aa_destroy_seqs()
795 free(taa_data->irqs_seq); in timerlat_aa_destroy_seqs()
798 if (taa_data->softirqs_seq) { in timerlat_aa_destroy_seqs()
799 trace_seq_destroy(taa_data->softirqs_seq); in timerlat_aa_destroy_seqs()
800 free(taa_data->softirqs_seq); in timerlat_aa_destroy_seqs()
803 if (taa_data->threads_seq) { in timerlat_aa_destroy_seqs()
804 trace_seq_destroy(taa_data->threads_seq); in timerlat_aa_destroy_seqs()
805 free(taa_data->threads_seq); in timerlat_aa_destroy_seqs()
808 if (taa_data->stack_seq) { in timerlat_aa_destroy_seqs()
809 trace_seq_destroy(taa_data->stack_seq); in timerlat_aa_destroy_seqs()
810 free(taa_data->stack_seq); in timerlat_aa_destroy_seqs()
816 * timerlat_aa_init_seqs - Init seq files used to store parsed information
823 * Returns 0 on success, -1 otherwise.
830 for (i = 0; i < taa_ctx->nr_cpus; i++) { in timerlat_aa_init_seqs()
834 taa_data->prev_irqs_seq = calloc(1, sizeof(*taa_data->prev_irqs_seq)); in timerlat_aa_init_seqs()
835 if (!taa_data->prev_irqs_seq) in timerlat_aa_init_seqs()
838 trace_seq_init(taa_data->prev_irqs_seq); in timerlat_aa_init_seqs()
840 taa_data->nmi_seq = calloc(1, sizeof(*taa_data->nmi_seq)); in timerlat_aa_init_seqs()
841 if (!taa_data->nmi_seq) in timerlat_aa_init_seqs()
844 trace_seq_init(taa_data->nmi_seq); in timerlat_aa_init_seqs()
846 taa_data->irqs_seq = calloc(1, sizeof(*taa_data->irqs_seq)); in timerlat_aa_init_seqs()
847 if (!taa_data->irqs_seq) in timerlat_aa_init_seqs()
850 trace_seq_init(taa_data->irqs_seq); in timerlat_aa_init_seqs()
852 taa_data->softirqs_seq = calloc(1, sizeof(*taa_data->softirqs_seq)); in timerlat_aa_init_seqs()
853 if (!taa_data->softirqs_seq) in timerlat_aa_init_seqs()
856 trace_seq_init(taa_data->softirqs_seq); in timerlat_aa_init_seqs()
858 taa_data->threads_seq = calloc(1, sizeof(*taa_data->threads_seq)); in timerlat_aa_init_seqs()
859 if (!taa_data->threads_seq) in timerlat_aa_init_seqs()
862 trace_seq_init(taa_data->threads_seq); in timerlat_aa_init_seqs()
864 taa_data->stack_seq = calloc(1, sizeof(*taa_data->stack_seq)); in timerlat_aa_init_seqs()
865 if (!taa_data->stack_seq) in timerlat_aa_init_seqs()
868 trace_seq_init(taa_data->stack_seq); in timerlat_aa_init_seqs()
875 return -1; in timerlat_aa_init_seqs()
879 * timerlat_aa_unregister_events - Unregister events used in the auto-analysis
884 tep_unregister_event_handler(tool->trace.tep, -1, "ftrace", "timerlat", in timerlat_aa_unregister_events()
887 tracefs_event_disable(tool->trace.inst, "osnoise", NULL); in timerlat_aa_unregister_events()
889 tep_unregister_event_handler(tool->trace.tep, -1, "osnoise", "nmi_noise", in timerlat_aa_unregister_events()
892 tep_unregister_event_handler(tool->trace.tep, -1, "osnoise", "irq_noise", in timerlat_aa_unregister_events()
895 tep_unregister_event_handler(tool->trace.tep, -1, "osnoise", "softirq_noise", in timerlat_aa_unregister_events()
898 tep_unregister_event_handler(tool->trace.tep, -1, "osnoise", "thread_noise", in timerlat_aa_unregister_events()
901 tep_unregister_event_handler(tool->trace.tep, -1, "ftrace", "kernel_stack", in timerlat_aa_unregister_events()
906 tracefs_event_disable(tool->trace.inst, "sched", "sched_switch"); in timerlat_aa_unregister_events()
907 tep_unregister_event_handler(tool->trace.tep, -1, "sched", "sched_switch", in timerlat_aa_unregister_events()
910 tracefs_event_disable(tool->trace.inst, "workqueue", "workqueue_execute_start"); in timerlat_aa_unregister_events()
911 tep_unregister_event_handler(tool->trace.tep, -1, "workqueue", "workqueue_execute_start", in timerlat_aa_unregister_events()
916 * timerlat_aa_register_events - Register events used in the auto-analysis
918 * Returns 0 on success, -1 otherwise.
924 tep_register_event_handler(tool->trace.tep, -1, "ftrace", "timerlat", in timerlat_aa_register_events()
929 * register auto-analysis handlers. in timerlat_aa_register_events()
931 retval = tracefs_event_enable(tool->trace.inst, "osnoise", NULL); in timerlat_aa_register_events()
937 tep_register_event_handler(tool->trace.tep, -1, "osnoise", "nmi_noise", in timerlat_aa_register_events()
940 tep_register_event_handler(tool->trace.tep, -1, "osnoise", "irq_noise", in timerlat_aa_register_events()
943 tep_register_event_handler(tool->trace.tep, -1, "osnoise", "softirq_noise", in timerlat_aa_register_events()
946 tep_register_event_handler(tool->trace.tep, -1, "osnoise", "thread_noise", in timerlat_aa_register_events()
949 tep_register_event_handler(tool->trace.tep, -1, "ftrace", "kernel_stack", in timerlat_aa_register_events()
958 retval = tracefs_event_enable(tool->trace.inst, "sched", "sched_switch"); in timerlat_aa_register_events()
964 tep_register_event_handler(tool->trace.tep, -1, "sched", "sched_switch", in timerlat_aa_register_events()
967 retval = tracefs_event_enable(tool->trace.inst, "workqueue", "workqueue_execute_start"); in timerlat_aa_register_events()
973 tep_register_event_handler(tool->trace.tep, -1, "workqueue", "workqueue_execute_start", in timerlat_aa_register_events()
980 return -1; in timerlat_aa_register_events()
984 * timerlat_aa_destroy - Destroy timerlat auto-analysis
993 if (!taa_ctx->taa_data) in timerlat_aa_destroy()
996 timerlat_aa_unregister_events(taa_ctx->tool, taa_ctx->dump_tasks); in timerlat_aa_destroy()
998 free(taa_ctx->taa_data); in timerlat_aa_destroy()
1004 * timerlat_aa_init - Initialize timerlat auto-analysis
1006 * Returns 0 on success, -1 otherwise.
1016 return -1; in timerlat_aa_init()
1020 taa_ctx->nr_cpus = nr_cpus; in timerlat_aa_init()
1021 taa_ctx->tool = tool; in timerlat_aa_init()
1022 taa_ctx->dump_tasks = dump_tasks; in timerlat_aa_init()
1024 taa_ctx->taa_data = calloc(nr_cpus, sizeof(*taa_ctx->taa_data)); in timerlat_aa_init()
1025 if (!taa_ctx->taa_data) in timerlat_aa_init()
1040 return -1; in timerlat_aa_init()