On Tue, Aug 08, 2017 at 05:31:29PM +0800, Chunyan Zhang wrote:
[...]
- On PC, fill the binary traces into perf.data to replace the
original trace section in perf.data: # dd if=./perf_whale2.data of=./perf_comp_0807.data bs=1 count=1496 # dd if=./cstrace_0807-v4.9.bin of=./perf_comp_0807.data bs=1 count=32768 seek=1496 # dd if=./perf_whale2.data of=./perf_comp_0807.data bs=1 count=2804 seek=34264 skip=34264
This is an example for Whale2 case, you must've noticed there're a few numbers (i.e. 1496, 32768, 2804) which are the size of header, trace binary, and tail of perf.data. I would suggest to use 'perf report --dump' to know these values.
For example, in whale2 case, I got the following data by 'perf report --dump':
[snip]
0x5a8 [0x30]: PERF_RECORD_AUXTRACE size: 0x8000 offset: 0 ref: 0x1eeb385f3231f044 idx: 0 tid: 516 cpu: -1
. ... CoreSight ETM Trace data: size 32768 bytes 38: id[14] I_NOT_SYNC : I Stream not synchronised
[snip]
Please notice the sentence 'CoreSight ETM Trace data: size 32768 bytes' and '0x5a8 [0x30]' above it. From this we can know the header size is 0x5a8 + 0x30 = 0x5d8 (i.e. 1496 dec), trace binary is 32768, then it's easy to know the size of perf.data tail since we know the total size of perf.data.
Hope that I have've made this clear :)
Nice sharing, Chunyan. I used dumb method to print log from perf tool, your method is much better :)
Thanks, Leo Yan