Hi Wojciech,
Are you still working on this patchset here? https://lists.linaro.org/pipermail/coresight/2019-June/002871.html
I'm asking because I was also looking to make a change related to timestamps, and I see there has been quite a bit of discussion on your one over the revisions.
My change would be something like I've pasted below. This was suggested by Al Grant so that the synthesized samples have kernel timestamps that can be correlated (at least roughly) with MMAP and COMM records.
The issue is that in your patchset, you are also setting the sample.time field, but with the decoded timestamp rather than the kernel one. I suppose this email is to re-start the discussion with the whole mailing list about what should be in that field.
Thanks James
---
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 7206c7f..7f7a68c 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -55,6 +55,7 @@ struct cs_etm_auxtrace { u8 sample_instructions;
int num_cpu; + u64 latest_timestamp; u32 auxtrace_type; u64 branches_sample_type; u64 branches_id; @@ -1152,6 +1153,7 @@ static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq, event->sample.header.misc = cs_etm__cpu_mode(etmq, addr); event->sample.header.size = sizeof(struct perf_event_header);
+ sample.time = etm->latest_timestamp; sample.ip = addr; sample.pid = tidq->pid; sample.tid = tidq->tid; @@ -1209,6 +1211,7 @@ static int cs_etm__synth_branch_sample(struct cs_etm_queue *etmq, event->sample.header.misc = cs_etm__cpu_mode(etmq, ip); event->sample.header.size = sizeof(struct perf_event_header);
+ sample.time = etm->latest_timestamp; sample.ip = ip; sample.pid = tidq->pid; sample.tid = tidq->tid; @@ -2367,8 +2370,10 @@ static int cs_etm__process_event(struct perf_session *session, return cs_etm__process_switch_cpu_wide(etm, event);
if (!etm->timeless_decoding && - event->header.type == PERF_RECORD_AUX) + event->header.type == PERF_RECORD_AUX) { + etm->latest_timestamp = timestamp; return cs_etm__process_queues(etm); + }
return 0; }