On Thu, Apr 02, 2020 at 11:33:42AM +0200, [email protected] wrote: > Dear Stefano, > > 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 > 1 > $ cat /proc/sys/kernel/perf_event_paranoid > -1 > $ 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_DATA="qemu_perf.data" > perf record -a -e kvm:kvm_entry -e kvm:kvm_pio -e sched:sched_process_exec \ > -o $PERF_DATA & > PERF_PID=$! # Wait some seconds to have perf record ready sleep 3 > > 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 > kill $PERF_PID > > # 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 > in trace_begin > 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): > Aborted > > Thank you again for your help! Let me now if this helps! Stefano
