[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance measurement

From: sterbl . ta
Subject: Re: Performance measurement
Date: Thu, 2 Apr 2020 11:33:42 +0200 (CEST)

Dear Stefano,

First thank you for providing the script. It's really 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

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 &

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):

Thank you again for your help!

Apr 2, 2020, 08:06 by address@hidden:

On Wed, Apr 01, 2020 at 11:33:26PM +0200, sterbl.ta--- via wrote:
Sorry I am not sure if this is the right place to ask but this is the only mailing list that most relevant. Apologize if this is not, and please let me know which place I should check. Thank you.

My main question is I want to measure the boot time of image running using qemu. And I come across to this repo https://github.com/stefano-garzarella/qemu-boot-time#how-to-use which can achieve my goal.

So I try replacing qemu startup command in How to use section with mine below

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

perf record command generates qemu_perf.data file without a problem. But the problem raises when trying to run the command
perf script -s qemu-boot-time/perf-script/qemu-perf-script.py -i \ qemu_perf.data

It throws

in trace_beginTraceback (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

Even after export env variable PERF_EXEC_PATH to /path/to/linux-source-5.4/tools/perf (where Core.py, Utils.py files located in linux kernel source 5.4)

So my questions:

How can I fix this?

I'm the author of the script.

Can you send me the entire output of 'perf script' and the
qemu_perf.data file?

Did you enable the kvm events following the "Prerequisites" section?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]