This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Problems with gettimeofday_ns()
- From: Masami Hiramatsu <mhiramat at redhat dot com>
- To: "Julio M. Merino Vidal" <jmerino at ac dot upc dot edu>
- Cc: systemtap at sources dot redhat dot com
- Date: Thu, 21 Feb 2008 09:10:55 -0500
- Subject: Re: Problems with gettimeofday_ns()
- References: <4B37407C-3D69-4E21-9C39-52A4D97B8B3C@ac.upc.edu>
Hello,
Julio M. Merino Vidal wrote:
> But the big problem is that sometimes I receive events in the
> incorrect order! That is, I place a marker B after a marker A in the
> code, and I know it is impossible for B to appear before A in a
> trace. However, sometimes, I get B before A in the final trace with
> the timings (supposedly) reversed. I also print the CPU that fired
> the events, and both are happening from the same virtual CPU, so the
> possibility of both CPUs using different timings is not relevant.
Indeed. The systemtap's gettimeofday_*() tries to adjust base-time
(this means, change the base-time forward and backward) periodically.
It is for synchronizing trace logs with in-kernel logs(dmesg, etc).
We are discussing about this on bz3916,
http://sources.redhat.com/bugzilla/show_bug.cgi?id=3916
> If I change the gettimeofday_ns call to get_cycles or to a custom
> counter instead, things go perfectly.
Sure, I think it is the best way to get the monotonic counter on
some processors.
> Any idea about why this is happening? May it be a bug in stap, or am
> I missing something in the way gettimeofday works?
>
> Thanks.
Thanks,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com