Placing "sleep 3" before qemu-system-x86_64 command as suggested fixes the problem. Thank you once again for your kindly help, most appreciate it!
On Thu, Apr 02, 2020 at 11:33:42AM +0200, address@hidden wrote:
First thank you for providing the script. It's really useful!
You're welcome! I'm happy that it could be useful :-)
I executed the commands in prerequisite section before running the perf script, and its output as below
$ cat /sys/kernel/debug/tracing/events/kvm/enable
$ cat /proc/sys/kernel/perf_event_paranoid
$ ls -ld /sys/kernel/debug
drwxr-xr-x 40 root root 0 Apr 1 21:25 /sys/kernel/debug
$ ls -ld /sys/kernel/debug/tracing
drwxr-xr-x 6 root root 0 Apr 1 21:25 /sys/kernel/debug/tracing
The size of qemu_perf.data is around 74M (can't be attached), so I put it in the link https://drive.google.com/file/d/14d0PATAK9ldep65aJ4D-SgBImVIO_cjc/view?usp=sharing
looking at your data (perf script -i qemu_perf.data), seems that the
'sched_process_exec' event is not recorded and it usually happens because
'perf record' takes some time to initialize before starting record.
So you can put a 'sleep 3' before you start QEMU as a workaround (maybe I
should update the README in the repository...)
And below is the script used to generate the qemu_perf.data (After executing this script, the vm was started, I login then execute shutdown command `sudo shutdown -Ph now` to return back to the command prompt.
# Start perf record to get the trace events
perf record -a -e kvm:kvm_entry -e kvm:kvm_pio -e sched:sched_process_exec \
-o $PERF_DATA &
# Wait some seconds to have perf record ready
qemu-system-x86_64 -enable-kvm \
-drive "file=disk.img,if=virtio" -drive "file=seed.img,if=virtio,format=raw" \
-device virtio-net-pci,netdev=net00 --netdev type=user,id=net00 \
-m 512 -nographic
# Stop perf record
# Get the measurements
perf script -s qemu-boot-time/perf-script/qemu-perf-script.py -i $PERF_DATA
Also the script got executed and it output (error) is as follow:
$ perf script -s qemu-boot-time/perf-script/qemu-perf-script.py -i qemu_perf.data
Traceback (most recent call last):
File "qemu-boot-time/perf-script/qemu-perf-script.py", line 195, in kvm__kvm_entry
if (events.traces[pid].qemu_init_end != 0):
AttributeError: 'collections.defaultdict' object has no attribute 'qemu_init_end'
Fatal Python error: problem in Python trace event handler
Current thread 0x00007f41bdc5d800 (most recent call first):
Thank you again for your help!
Let me now if this helps!