Skip to content

Commit 48e8a7b

Browse files
James-A-Clarkacmel
authored andcommitted
perf cs-etm: Split --dump-raw-trace by AUX records
Currently --dump-raw-trace skips queueing and splitting buffers because of an early exit condition in cs_etm__process_auxtrace_info(). Once that is removed we can print the split data by using the queues and searching for split buffers with the same reference as the one that is currently being processed. This keeps the same behaviour of dumping in file order when an AUXTRACE event appears, rather than moving trace dump to where AUX records are in the file. There will be a newline and size printout for each fragment. For example this buffer is comprised of two AUX records, but was printed as one: 0 0 0x8098 [0x30]: PERF_RECORD_AUXTRACE size: 0xa0 offset: 0 ref: 0x491a4dfc52fc0e6e idx: 0 t . ... CoreSight ETM Trace data: size 160 bytes Idx:0; ID:10; I_ASYNC : Alignment Synchronisation. Idx:12; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 } Idx:17; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000000000000000; Idx:80; ID:10; I_ASYNC : Alignment Synchronisation. Idx:92; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 } Idx:97; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0xFFFFDE2AD3FD76D4; But is now printed as two fragments: 0 0 0x8098 [0x30]: PERF_RECORD_AUXTRACE size: 0xa0 offset: 0 ref: 0x491a4dfc52fc0e6e idx: 0 t . ... CoreSight ETM Trace data: size 80 bytes Idx:0; ID:10; I_ASYNC : Alignment Synchronisation. Idx:12; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 } Idx:17; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000000000000000; . ... CoreSight ETM Trace data: size 80 bytes Idx:80; ID:10; I_ASYNC : Alignment Synchronisation. Idx:92; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 } Idx:97; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0xFFFFDE2AD3FD76D4; Decoding errors that appeared in problematic files are now not present, for example: Idx:808; ID:1c; I_BAD_SEQUENCE : Invalid Sequence in packet.[I_ASYNC] ... PKTP_ETMV4I_0016 : 0x0014 (OCSD_ERR_INVALID_PCKT_HDR) [Invalid packet header]; TrcIdx=822 Signed-off-by: James Clark <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Tested-by: Leo Yan <[email protected]> Cc: Al Grant <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Anshuman Khandual <[email protected]> Cc: Branislav Rankov <[email protected]> Cc: Denis Nikitin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Suzuki Poulouse <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Cc: [email protected] Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent ff11764 commit 48e8a7b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tools/perf/util/cs-etm.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,6 +2434,22 @@ static int cs_etm__process_event(struct perf_session *session,
24342434
return 0;
24352435
}
24362436

2437+
static void dump_queued_data(struct cs_etm_auxtrace *etm,
2438+
struct perf_record_auxtrace *event)
2439+
{
2440+
struct auxtrace_buffer *buf;
2441+
unsigned int i;
2442+
/*
2443+
* Find all buffers with same reference in the queues and dump them.
2444+
* This is because the queues can contain multiple entries of the same
2445+
* buffer that were split on aux records.
2446+
*/
2447+
for (i = 0; i < etm->queues.nr_queues; ++i)
2448+
list_for_each_entry(buf, &etm->queues.queue_array[i].head, list)
2449+
if (buf->reference == event->reference)
2450+
cs_etm__dump_event(etm, buf);
2451+
}
2452+
24372453
static int cs_etm__process_auxtrace_event(struct perf_session *session,
24382454
union perf_event *event,
24392455
struct perf_tool *tool __maybe_unused)
@@ -2466,7 +2482,8 @@ static int cs_etm__process_auxtrace_event(struct perf_session *session,
24662482
cs_etm__dump_event(etm, buffer);
24672483
auxtrace_buffer__put_data(buffer);
24682484
}
2469-
}
2485+
} else if (dump_trace)
2486+
dump_queued_data(etm, &event->auxtrace);
24702487

24712488
return 0;
24722489
}
@@ -3042,7 +3059,6 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
30423059

30433060
if (dump_trace) {
30443061
cs_etm__print_auxtrace_info(auxtrace_info->priv, num_cpu);
3045-
return 0;
30463062
}
30473063

30483064
err = cs_etm__synth_events(etm, session);

0 commit comments

Comments
 (0)