Simple tool to infer accuracy level in case of combined host-guest tracing sessions done with trace-cmd
With the trace-cmd
tool is possible to start a combined tracing session, where you can trace at the same time the various events coming from a host and the ones from multiple guests in a virtualized environment.
Like that, the host instance of trace-cmd
recovers the traces generated by the trace-cmd agent
inside the guests, and merges all the events in a single trace file, re-adjusting the different timestamps.
This last step is the most difficult one, which leaves more than some room for accuracy error. trace-cmd
's developers implemented two different mechanisms to accomplish that:
- Run the
PTP
(Precision Time Protocol) - When possible, directly use the KVM entries (
kvm_scaling
)
During the development of the two "protocols" used to synchronize the two clocks, some sort of quality standard was needed, not only to asses the results between different "protocols", but also for the different implementation version of the same one.
Therefore, a methodology to evaluate the overall accuracy level of a combined tracing session has been proposed, and the implementation is in this repository.
At a higher level, the idea is to find events that we can define "consequential": given a determined event on the guest side, a specific event on the host side must be visible in the trace, originated by this last one. For each pair of events found, a difference of timestamps can be calculated, collecting different samples to later exploit.
The "difficult" part is finding these peculiar pair of events. For the purpose of the work, two of this kind have been found:
hrtimer_start
intokvm_exit
cpu_idle
intokvm_exit
The Kernelshark libraries are needed, so all its dependencies are needed.