Hi All,

Summary of the discussion and different approaches we had on IRC
regarding a top(1) tool in qemu

Implement unique naming for all event loop resources.  Sometimes a
string literal can be used but other times the unique name needs to be
generated at runtime (e.g. filename for an fd).

Approach 1)
For a built-in QMP implementation:
We have callbacks from fds, BHs and Timers
So everytime one of them is registered - we add them to the list(what
we see through QMP)
and when they are unregistered - we remove them from the list.
Ex: aio_set_fd_handler(fd, NULL, NULL, NULL) - unregistering an fd -
will remove the fd from the list.

QMP API:
set-event-loop-profiling enable=on/off
[interval=seconds] [iothread=name] and it emits a QMP event with
[{name, counter, time_elapsed}]

Pros:
It works on all systems.
Cons:
Information present inside glib is exposed only via systemtap tracing
- these will not be available via QMP.
For example - I/O in chardevs, network IO etc

Approach 2)
Using Trace:
Add trace event for each type of event loop resource (timer, fd, bh,
etc) in order to see when a resource fires.
Write top(1)-like SystemTap script to get data from the trace backend.

Pros:
No performance overhead using trace

Cons:
The data available from trace depends on the trace-backend that qemu
is configured with.
It is dependent on availability of SystemTap and is backend specific

Approach 3)
Use Trace and extract trace backend data through QMP

Pros:
No performance overhead using trace

Cons:
User has to configure QMP to point to the trace backend.

Please let me know which implementation it is that I should follow and work on.

If I've missed out on anything important. Please add those points to this mail.

Regards,
Prashanth Sunder

Reply via email to