systemtap has been requested to implement a gettimeofday_ns
call. To do this with the current code, src/runtime/time.c
would need to change.
It may be sufficient to change _stp_time_init to preserve
cpufreq_get() (a kilohertz number ?) rather than dividing it
to store only a megahertz figure, and to rename _stp_gettimeofday_us
to _stp_gettimeofday_ns. The tapset callers would of course have to
I did the kHz change, but that actually takes the units the wrong direction.
Before, we did cycles/MHz = cycles/(cycles/usec) = usec. With kHz, you have
cycles/kHz = cycles/(cycles/msec) = msec. Thus, a 1E6 adjustment is needed,
best before the division.
cycles * (1E6 nsec/msec) / (cycles/msec) = nsec
So, I was using MHz because it conveniently led to microseconds. To
conveniently divide to nanoseconds we would need to use GHz, but with integers
that is too imprecise. So now we're keeping kHz, and we can deal with an extra