diff options
| -rw-r--r-- | tools/perf/util/cs-etm.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 996317687ce7..f76648fa6768 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -67,6 +67,8 @@ struct cs_etm_auxtrace { bool snapshot_mode; bool data_queued; bool has_virtual_ts; /* Virtual/Kernel timestamps in the trace. */ + bool use_thread_stack; + bool use_callchain; int num_cpu; u64 latest_kernel_timestamp; @@ -656,7 +658,7 @@ static int cs_etm__init_traceid_queue(struct cs_etm_queue *etmq, if (!tidq->prev_packet) goto out_free; - if (etm->synth_opts.last_branch) { + if (etm->use_thread_stack) { size_t sz = sizeof(struct branch_stack); sz += etm->synth_opts.last_branch_sz * @@ -1572,7 +1574,7 @@ static void cs_etm__add_stack_event(struct cs_etm_queue *etmq, if (!cs_etm__packet_has_taken_branch(tidq->prev_packet)) return; - if (etmq->etm->synth_opts.last_branch) { + if (etmq->etm->use_thread_stack) { from = cs_etm__last_executed_instr(tidq->prev_packet); to = cs_etm__first_executed_instr(tidq->packet); @@ -1581,7 +1583,8 @@ static void cs_etm__add_stack_event(struct cs_etm_queue *etmq, /* Enable callchain so thread stack entry can be allocated */ thread_stack__event(tidq->frontend_thread, tidq->prev_packet->cpu, tidq->prev_packet->flags, from, to, size, - etmq->buffer->buffer_nr + 1, false, + etmq->buffer->buffer_nr + 1, + etmq->etm->use_callchain, tidq->br_stack_sz, 0); } else { thread_stack__set_trace_nr(tidq->frontend_thread, @@ -1991,7 +1994,7 @@ swap_packet: cs_etm__packet_swap(etm, tidq); /* Reset last branches after flush the trace */ - if (etm->synth_opts.last_branch) + if (etm->use_thread_stack) thread_stack__flush(tidq->frontend_thread); return err; @@ -2054,7 +2057,7 @@ static void cs_etm__flush_all_stack(struct cs_etm_queue *etmq) { enum cs_etm_pid_fmt pid_fmt = cs_etm__get_pid_fmt(etmq); - if (!etmq->etm->synth_opts.last_branch) + if (!etmq->etm->use_thread_stack) return; switch (pid_fmt) { @@ -3556,6 +3559,7 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event, itrace_synth_opts__set_default(&etm->synth_opts, session->itrace_synth_opts->default_no_sample); etm->synth_opts.callchain = false; + etm->synth_opts.thread_stack = session->itrace_synth_opts->thread_stack; } if (etm->synth_opts.calls) @@ -3617,6 +3621,12 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event, etm->tc.cap_user_time_zero = tc->cap_user_time_zero; etm->tc.cap_user_time_short = tc->cap_user_time_short; } + + etm->use_thread_stack = etm->synth_opts.thread_stack || + etm->synth_opts.last_branch; + + etm->use_callchain = etm->synth_opts.thread_stack; + err = cs_etm__synth_events(etm, session); if (err) goto err_free_queues; |
