Lines Matching refs:taa_data
111 struct timerlat_aa_data *taa_data; member
142 return &taa_ctx->taa_data[cpu]; in timerlat_aa_get_data()
148 static int timerlat_aa_irq_latency(struct timerlat_aa_data *taa_data, in timerlat_aa_irq_latency() argument
156 taa_data->curr_state = TIMERLAT_WAITING_THREAD; in timerlat_aa_irq_latency()
157 taa_data->tlat_irq_timstamp = record->ts; in timerlat_aa_irq_latency()
162 taa_data->thread_nmi_sum = 0; in timerlat_aa_irq_latency()
163 taa_data->thread_irq_sum = 0; in timerlat_aa_irq_latency()
164 taa_data->thread_softirq_sum = 0; in timerlat_aa_irq_latency()
165 taa_data->thread_thread_sum = 0; in timerlat_aa_irq_latency()
166 taa_data->thread_blocking_duration = 0; in timerlat_aa_irq_latency()
167 taa_data->timer_irq_start_time = 0; in timerlat_aa_irq_latency()
168 taa_data->timer_irq_duration = 0; in timerlat_aa_irq_latency()
169 taa_data->timer_exit_from_idle = 0; in timerlat_aa_irq_latency()
174 trace_seq_reset(taa_data->nmi_seq); in timerlat_aa_irq_latency()
175 trace_seq_reset(taa_data->irqs_seq); in timerlat_aa_irq_latency()
176 trace_seq_reset(taa_data->softirqs_seq); in timerlat_aa_irq_latency()
177 trace_seq_reset(taa_data->threads_seq); in timerlat_aa_irq_latency()
180 tep_get_field_val(s, event, "timer_latency", record, &taa_data->tlat_irq_latency, 1); in timerlat_aa_irq_latency()
181 tep_get_field_val(s, event, "seqnum", record, &taa_data->tlat_irq_seqnum, 1); in timerlat_aa_irq_latency()
184 tep_get_common_field_val(s, event, "common_pid", record, &taa_data->run_thread_pid, 1); in timerlat_aa_irq_latency()
191 if (taa_data->run_thread_pid) in timerlat_aa_irq_latency()
197 if (taa_data->tlat_irq_latency < taa_data->max_exit_idle_latency) in timerlat_aa_irq_latency()
204 if (taa_data->tlat_irq_timstamp - taa_data->tlat_irq_latency in timerlat_aa_irq_latency()
205 < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) in timerlat_aa_irq_latency()
208 taa_data->max_exit_idle_latency = taa_data->tlat_irq_latency; in timerlat_aa_irq_latency()
216 static int timerlat_aa_thread_latency(struct timerlat_aa_data *taa_data, in timerlat_aa_thread_latency() argument
224 taa_data->curr_state = TIMERLAT_WAITING_IRQ; in timerlat_aa_thread_latency()
225 taa_data->tlat_thread_timstamp = record->ts; in timerlat_aa_thread_latency()
228 tep_get_field_val(s, event, "timer_latency", record, &taa_data->tlat_thread_latency, 1); in timerlat_aa_thread_latency()
229 tep_get_field_val(s, event, "seqnum", record, &taa_data->tlat_thread_seqnum, 1); in timerlat_aa_thread_latency()
245 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_handler() local
248 if (!taa_data) in timerlat_aa_handler()
253 return timerlat_aa_irq_latency(taa_data, s, record, event); in timerlat_aa_handler()
255 return timerlat_aa_thread_latency(taa_data, s, record, event); in timerlat_aa_handler()
268 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_nmi_handler() local
275 if (taa_data->curr_state == TIMERLAT_WAITING_IRQ) { in timerlat_aa_nmi_handler()
276 taa_data->prev_irq_duration = duration; in timerlat_aa_nmi_handler()
277 taa_data->prev_irq_timstamp = start; in timerlat_aa_nmi_handler()
279 trace_seq_reset(taa_data->prev_irqs_seq); in timerlat_aa_nmi_handler()
280 trace_seq_printf(taa_data->prev_irqs_seq, " %24s %.*s %9.2f us\n", in timerlat_aa_nmi_handler()
287 taa_data->thread_nmi_sum += duration; in timerlat_aa_nmi_handler()
288 trace_seq_printf(taa_data->nmi_seq, " %24s %.*s %9.2f us\n", in timerlat_aa_nmi_handler()
311 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_irq_handler() local
327 if (taa_data->curr_state == TIMERLAT_WAITING_IRQ) { in timerlat_aa_irq_handler()
328 taa_data->prev_irq_duration = duration; in timerlat_aa_irq_handler()
329 taa_data->prev_irq_timstamp = start; in timerlat_aa_irq_handler()
331 trace_seq_reset(taa_data->prev_irqs_seq); in timerlat_aa_irq_handler()
332 trace_seq_printf(taa_data->prev_irqs_seq, " %24s:%-3llu %.*s %9.2f us\n", in timerlat_aa_irq_handler()
343 if (!taa_data->timer_irq_start_time) { in timerlat_aa_irq_handler()
344 expected_start = taa_data->tlat_irq_timstamp - taa_data->tlat_irq_latency; in timerlat_aa_irq_handler()
346 taa_data->timer_irq_start_time = start; in timerlat_aa_irq_handler()
347 taa_data->timer_irq_duration = duration; in timerlat_aa_irq_handler()
362 if (expected_start < taa_data->timer_irq_start_time) in timerlat_aa_irq_handler()
363 taa_data->timer_irq_start_delay = taa_data->timer_irq_start_time - expected_start; in timerlat_aa_irq_handler()
365 taa_data->timer_irq_start_delay = 0; in timerlat_aa_irq_handler()
370 if (taa_data->run_thread_pid) in timerlat_aa_irq_handler()
373 if (expected_start > taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) in timerlat_aa_irq_handler()
374 taa_data->timer_exit_from_idle = taa_data->timer_irq_start_delay; in timerlat_aa_irq_handler()
382 taa_data->thread_irq_sum += duration; in timerlat_aa_irq_handler()
383 trace_seq_printf(taa_data->irqs_seq, " %24s:%-3llu %.*s %9.2f us\n", in timerlat_aa_irq_handler()
407 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_softirq_handler() local
412 if (taa_data->curr_state == TIMERLAT_WAITING_IRQ) in timerlat_aa_softirq_handler()
419 taa_data->thread_softirq_sum += duration; in timerlat_aa_softirq_handler()
421 trace_seq_printf(taa_data->softirqs_seq, " %24s:%-3llu %.*s %9.2f us\n", in timerlat_aa_softirq_handler()
440 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_thread_handler() local
447 if (taa_data->curr_state == TIMERLAT_WAITING_IRQ) in timerlat_aa_thread_handler()
456 if (pid == taa_data->run_thread_pid && !taa_data->thread_blocking_duration) { in timerlat_aa_thread_handler()
457 taa_data->thread_blocking_duration = duration; in timerlat_aa_thread_handler()
460 strncpy(taa_data->run_thread_comm, comm, MAX_COMM); in timerlat_aa_thread_handler()
462 sprintf(taa_data->run_thread_comm, "<...>"); in timerlat_aa_thread_handler()
465 taa_data->thread_thread_sum += duration; in timerlat_aa_thread_handler()
467 trace_seq_printf(taa_data->threads_seq, " %24s:%-12llu %.*s %9.2f us\n", in timerlat_aa_thread_handler()
485 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_stack_handler() local
490 trace_seq_reset(taa_data->stack_seq); in timerlat_aa_stack_handler()
492 trace_seq_printf(taa_data->stack_seq, " Blocking thread stack trace\n"); in timerlat_aa_stack_handler()
499 trace_seq_printf(taa_data->stack_seq, " %.*s -> %s\n", in timerlat_aa_stack_handler()
517 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_sched_switch_handler() local
521 tep_get_field_val(s, event, "next_pid", record, &taa_data->current_pid, 1); in timerlat_aa_sched_switch_handler()
524 strncpy(taa_data->current_comm, comm, MAX_COMM); in timerlat_aa_sched_switch_handler()
529 taa_data->kworker = 0; in timerlat_aa_sched_switch_handler()
530 taa_data->kworker_func = 0; in timerlat_aa_sched_switch_handler()
548 struct timerlat_aa_data *taa_data = timerlat_aa_get_data(taa_ctx, record->cpu); in timerlat_aa_kworker_start_handler() local
550 tep_get_field_val(s, event, "work", record, &taa_data->kworker, 1); in timerlat_aa_kworker_start_handler()
551 tep_get_field_val(s, event, "function", record, &taa_data->kworker_func, 1); in timerlat_aa_kworker_start_handler()
560 static void timerlat_thread_analysis(struct timerlat_aa_data *taa_data, int cpu, in timerlat_thread_analysis() argument
570 if (taa_data->tlat_irq_seqnum > taa_data->tlat_thread_seqnum) { in timerlat_thread_analysis()
572 total = taa_data->tlat_irq_latency; in timerlat_thread_analysis()
575 total = taa_data->tlat_thread_latency; in timerlat_thread_analysis()
583 exp_irq_ts = taa_data->timer_irq_start_time - taa_data->timer_irq_start_delay; in timerlat_thread_analysis()
584 if (exp_irq_ts < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) { in timerlat_thread_analysis()
585 if (taa_data->prev_irq_timstamp < taa_data->timer_irq_start_time) in timerlat_thread_analysis()
588 ns_to_usf(taa_data->prev_irq_duration)); in timerlat_thread_analysis()
595 (ns_to_usf(taa_data->timer_exit_from_idle) > 10) ? "(exit from idle)" : "", in timerlat_thread_analysis()
596 ns_to_usf(taa_data->timer_irq_start_delay), in timerlat_thread_analysis()
597 ns_to_per(total, taa_data->timer_irq_start_delay)); in timerlat_thread_analysis()
603 ns_to_usf(taa_data->tlat_irq_latency)); in timerlat_thread_analysis()
614 printf(" %.*s %24s:%-9llu\n", 6, spaces, taa_data->run_thread_comm, in timerlat_thread_analysis()
615 taa_data->run_thread_pid); in timerlat_thread_analysis()
622 ns_to_usf(taa_data->timer_irq_duration), in timerlat_thread_analysis()
623 ns_to_per(total, taa_data->timer_irq_duration)); in timerlat_thread_analysis()
632 ns_to_usf(taa_data->thread_blocking_duration), in timerlat_thread_analysis()
633 ns_to_per(total, taa_data->thread_blocking_duration)); in timerlat_thread_analysis()
636 taa_data->run_thread_comm, taa_data->run_thread_pid, in timerlat_thread_analysis()
637 12, spaces, ns_to_usf(taa_data->thread_blocking_duration)); in timerlat_thread_analysis()
643 trace_seq_do_printf(taa_data->stack_seq); in timerlat_thread_analysis()
648 if (taa_data->thread_nmi_sum) in timerlat_thread_analysis()
650 ns_to_usf(taa_data->thread_nmi_sum), in timerlat_thread_analysis()
651 ns_to_per(total, taa_data->thread_nmi_sum)); in timerlat_thread_analysis()
662 if (taa_data->thread_irq_sum) { in timerlat_thread_analysis()
664 ns_to_usf(taa_data->thread_irq_sum), in timerlat_thread_analysis()
665 ns_to_per(total, taa_data->thread_irq_sum)); in timerlat_thread_analysis()
667 trace_seq_do_printf(taa_data->irqs_seq); in timerlat_thread_analysis()
673 if (taa_data->thread_softirq_sum) { in timerlat_thread_analysis()
675 ns_to_usf(taa_data->thread_softirq_sum), in timerlat_thread_analysis()
676 ns_to_per(total, taa_data->thread_softirq_sum)); in timerlat_thread_analysis()
678 trace_seq_do_printf(taa_data->softirqs_seq); in timerlat_thread_analysis()
689 if (taa_data->thread_thread_sum) { in timerlat_thread_analysis()
691 ns_to_usf(taa_data->thread_thread_sum), in timerlat_thread_analysis()
692 ns_to_per(total, taa_data->thread_thread_sum)); in timerlat_thread_analysis()
694 trace_seq_do_printf(taa_data->threads_seq); in timerlat_thread_analysis()
732 struct timerlat_aa_data *taa_data; in timerlat_auto_analysis() local
744 taa_data = timerlat_aa_get_data(taa_ctx, cpu); in timerlat_auto_analysis()
746 if (irq_thresh && taa_data->tlat_irq_latency >= irq_thresh) { in timerlat_auto_analysis()
748 timerlat_thread_analysis(taa_data, cpu, irq_thresh, thread_thresh); in timerlat_auto_analysis()
749 } else if (thread_thresh && (taa_data->tlat_thread_latency) >= thread_thresh) { in timerlat_auto_analysis()
751 timerlat_thread_analysis(taa_data, cpu, irq_thresh, thread_thresh); in timerlat_auto_analysis()
754 if (taa_data->max_exit_idle_latency > max_exit_from_idle) { in timerlat_auto_analysis()
755 max_exit_from_idle = taa_data->max_exit_idle_latency; in timerlat_auto_analysis()
772 taa_data = timerlat_aa_get_data(taa_ctx, cpu); in timerlat_auto_analysis()
775 printf(" [%.3d] %24s:%llu", cpu, taa_data->current_comm, taa_data->current_pid); in timerlat_auto_analysis()
777 if (taa_data->kworker_func) in timerlat_auto_analysis()
779 tep_find_function(tep, taa_data->kworker) ? : "<...>", in timerlat_auto_analysis()
780 tep_find_function(tep, taa_data->kworker_func)); in timerlat_auto_analysis()
791 struct timerlat_aa_data *taa_data; in timerlat_aa_destroy_seqs() local
794 if (!taa_ctx->taa_data) in timerlat_aa_destroy_seqs()
798 taa_data = timerlat_aa_get_data(taa_ctx, i); in timerlat_aa_destroy_seqs()
800 if (taa_data->prev_irqs_seq) { in timerlat_aa_destroy_seqs()
801 trace_seq_destroy(taa_data->prev_irqs_seq); in timerlat_aa_destroy_seqs()
802 free(taa_data->prev_irqs_seq); in timerlat_aa_destroy_seqs()
805 if (taa_data->nmi_seq) { in timerlat_aa_destroy_seqs()
806 trace_seq_destroy(taa_data->nmi_seq); in timerlat_aa_destroy_seqs()
807 free(taa_data->nmi_seq); in timerlat_aa_destroy_seqs()
810 if (taa_data->irqs_seq) { in timerlat_aa_destroy_seqs()
811 trace_seq_destroy(taa_data->irqs_seq); in timerlat_aa_destroy_seqs()
812 free(taa_data->irqs_seq); in timerlat_aa_destroy_seqs()
815 if (taa_data->softirqs_seq) { in timerlat_aa_destroy_seqs()
816 trace_seq_destroy(taa_data->softirqs_seq); in timerlat_aa_destroy_seqs()
817 free(taa_data->softirqs_seq); in timerlat_aa_destroy_seqs()
820 if (taa_data->threads_seq) { in timerlat_aa_destroy_seqs()
821 trace_seq_destroy(taa_data->threads_seq); in timerlat_aa_destroy_seqs()
822 free(taa_data->threads_seq); in timerlat_aa_destroy_seqs()
825 if (taa_data->stack_seq) { in timerlat_aa_destroy_seqs()
826 trace_seq_destroy(taa_data->stack_seq); in timerlat_aa_destroy_seqs()
827 free(taa_data->stack_seq); in timerlat_aa_destroy_seqs()
844 struct timerlat_aa_data *taa_data; in timerlat_aa_init_seqs() local
849 taa_data = timerlat_aa_get_data(taa_ctx, i); in timerlat_aa_init_seqs()
851 taa_data->prev_irqs_seq = calloc(1, sizeof(*taa_data->prev_irqs_seq)); in timerlat_aa_init_seqs()
852 if (!taa_data->prev_irqs_seq) in timerlat_aa_init_seqs()
855 trace_seq_init(taa_data->prev_irqs_seq); in timerlat_aa_init_seqs()
857 taa_data->nmi_seq = calloc(1, sizeof(*taa_data->nmi_seq)); in timerlat_aa_init_seqs()
858 if (!taa_data->nmi_seq) in timerlat_aa_init_seqs()
861 trace_seq_init(taa_data->nmi_seq); in timerlat_aa_init_seqs()
863 taa_data->irqs_seq = calloc(1, sizeof(*taa_data->irqs_seq)); in timerlat_aa_init_seqs()
864 if (!taa_data->irqs_seq) in timerlat_aa_init_seqs()
867 trace_seq_init(taa_data->irqs_seq); in timerlat_aa_init_seqs()
869 taa_data->softirqs_seq = calloc(1, sizeof(*taa_data->softirqs_seq)); in timerlat_aa_init_seqs()
870 if (!taa_data->softirqs_seq) in timerlat_aa_init_seqs()
873 trace_seq_init(taa_data->softirqs_seq); in timerlat_aa_init_seqs()
875 taa_data->threads_seq = calloc(1, sizeof(*taa_data->threads_seq)); in timerlat_aa_init_seqs()
876 if (!taa_data->threads_seq) in timerlat_aa_init_seqs()
879 trace_seq_init(taa_data->threads_seq); in timerlat_aa_init_seqs()
881 taa_data->stack_seq = calloc(1, sizeof(*taa_data->stack_seq)); in timerlat_aa_init_seqs()
882 if (!taa_data->stack_seq) in timerlat_aa_init_seqs()
885 trace_seq_init(taa_data->stack_seq); in timerlat_aa_init_seqs()
1010 if (!taa_ctx->taa_data) in timerlat_aa_destroy()
1015 free(taa_ctx->taa_data); in timerlat_aa_destroy()
1041 taa_ctx->taa_data = calloc(nr_cpus, sizeof(*taa_ctx->taa_data)); in timerlat_aa_init()
1042 if (!taa_ctx->taa_data) in timerlat_aa_init()