Skip to contentSkip to conversation

Modify the output of perf script

DISCUSSION Arnab 1 participant 1 message Dec 2, 2017

lore
Share & tools
lore

Arnab

author
#0 lore raw

Hello,

I have been using IntelPT and perf-kvm to collect guest VM generated PT packets from the host. I use the below command to record the IntelPT traces :-

./perf kvm --guest -guestkallsyms=~/guest-kallsyms -guestmodules=~/guest-modules -e intel_pt//

I am using the latest stable Linux kernel version that is 4.14.3 and I am using an Ubuntu 17.04 machine running on architecture x86_64.

The above command works fine and is giving me the correct outputs as I expect. Now I am trying to see the raw trace dump using perf script -D

./perf script -D -i perf.data.guest

I see all the event records and all their outputs correctly. But what I wanted was to make perf script only display me the events corresponding to IntelPT trace packets.

This means that I am especially not interested in events like PERF_RECORD_COMM and PERF_RECORD_FORK etc and even PERF_RECORD_MMAP/PERF_RECORD_MMAP2. I only want perf script to display me the raw trace packets under PERF_RECORD_AUXTRACE.

There are obviously two cases here which I have so far considered but have not been able to get anywhere :

1. I have tried making perf record stop recording events, which I do not want like PERF_RECORD_MMAP, PERF_RECORD_FORK etc. I have been unsuccessful and I also think this is not the right approach.

2. The other approach that I have tried is making perf script -D to not print the MMAP and FORK events instead but keep recording them. I have not been able to do this as I have not been able to trace back in the linux-kernel code where the actual print is happening. This looks correct and probably easier to achieve.

How can I achieve one of the two goals stated above ? How can I make perf script dump me exactly what I want ?

Thanks and Regards,
Arnab