How to do profiling with QEMU?

I develop the OS (as a hobby) using QEMU and GDB, but now I am facing some performance issues. Therefore, I would like to know which features should be optimized.

So basically, my needs are basically to know:

  • In which functions my kernel spends more time.
  • How many times are functions called

Do you know how I can do this? I would make a decision using Bochs too.

+4
source share
1 answer

As far as I can see, there is no web documentation for profiling QEMU, although I would be very surprised if there was no way to do profiling. If QEMU uses kvm virtualization (as opposed to modeling), there may also be some profiling tools available specifically for kvm .

However, since QEMU provides access to GDB, you can still use this! a bad person profiler periodically uses the GDB backtrace to find out what all your threads are doing, which can be very useful. This will give information about blocked threads as well as unlocked threads, but since you don't seem to know if your performance problems are due to blocking or not, this should be much more useful than nothing. If you felt particularly decisive, you could use this data to create more useful visualizations, such as Brendan Gregg's flame graphs .

The worst (but usually the simplest) technique will always choose some random functions in the code, which can be a bottleneck and output how much time each call takes. Incredible, but very useful when nothing is available.

+5
source

Source: https://habr.com/ru/post/1485172/


All Articles