[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv1 0/4] Timers: add timer debugging through -time
From: |
Alex Bligh |
Subject: |
Re: [Qemu-devel] [PATCHv1 0/4] Timers: add timer debugging through -timer-debug-log |
Date: |
Sat, 26 Oct 2013 09:24:30 +0100 |
Paolo,
On 26 Oct 2013, at 08:18, Paolo Bonzini wrote:
> The simple trace backend includes a nanosecond value that is the same as
> rt_clock, so you can correlate the last timer_mod with the next
> iteration in timerlist_run_timers (I would put the tracepoint inside the
> loop, just before the callback is done). Similarly, in systemtap you
> can just use the builtin gettimeofday_ns() function
>
> All clocks are basically in nanoseconds (the only difference between
> vm_clock and rt_clock is that the former stops when the VM is stopped),
> so you can get the average expiry delta from there.
>
> Of course it requires some postprocessing or a systemtap script, but we
> can put that into scripts/ or give it to the user. See
> https://sourceware.org/ml/systemtap/2011-q3/txt00003.txt for an example,
> I suppose the "expiry time" computation would look like this:
OK I need to look at the tracepoint stuff a bit more it seems :-)
If we can do this without a patch (save to put some tracepoints in),
that's obviously better than doing it with a patch. I don't like
the file particularly either.
> global modtime, expirytot, firedcnt
>
> probe qemu.system.x86_64.timer_mod {
> loc = sprintf("%s:%d", timer_file, timer_line)
How do timer_file and timer_line get filled in? If those still
need to be put in through code changes, how about taking
patch 1 of the series (that fills in timer->dbg with this
information), save for the unnecessary additions to the structure,
plus whatever is necessary to put the tracepoints in?
Alex
> modtime[pid(), loc] = gettimeofday_ns()
> }
> probe qemu.system.x86_64.timer_run {
> loc = sprintf("%s:%d", timer_file, timer_line)
> expirytot[pid(), loc] += gettimeofday_ns() - modtime[pid(), loc]
> firedcnt[pid(), loc]++
> }
>
> probe end
> {
> printf("\n%8s %28s %8s %8s\n", "pid", "loc", "avg expiry", "cnt")
> foreach([p+, loc] in firedcnt) {
> printf("%8d %28s %8d %8d\n", p, loc,
> expirytot[p, loc] / firedcnt[p, loc],
> firedcnt[p, loc])
> }
> }
--
Alex Bligh
- [Qemu-devel] [PATCHv1 0/4] Timers: add timer debugging through -timer-debug-log, Alex Bligh, 2013/10/25
- [Qemu-devel] [PATCHv1 1/4] Timers: add debugging macros wrapping timer functions and debug structures, Alex Bligh, 2013/10/25
- [Qemu-devel] [PATCHv1 3/4] Timers: Instrument timer_mod, Alex Bligh, 2013/10/25
- [Qemu-devel] [PATCHv1 2/4] Timers: add command line option -timer-debug-log, Alex Bligh, 2013/10/25
- [Qemu-devel] [PATCHv1 4/4] Timers: produce timer-debug-log file, Alex Bligh, 2013/10/25
- Re: [Qemu-devel] [PATCHv1 0/4] Timers: add timer debugging through -timer-debug-log, Paolo Bonzini, 2013/10/25