diff options
author | jistone <jistone> | 2006-09-20 21:01:56 +0000 |
---|---|---|
committer | jistone <jistone> | 2006-09-20 21:01:56 +0000 |
commit | faaa0db717917bd09a3c21baf71af40a2cc52738 (patch) | |
tree | 01e4c47f1650b9d0af3684e7b34f61128652245f /tapset/timestamp.stp | |
parent | 18c785eef991aae229e7416d1b5edfc9306fa3a7 (diff) | |
download | systemtap-steved-faaa0db717917bd09a3c21baf71af40a2cc52738.tar.gz systemtap-steved-faaa0db717917bd09a3c21baf71af40a2cc52738.tar.xz systemtap-steved-faaa0db717917bd09a3c21baf71af40a2cc52738.zip |
2006-09-20 Josh Stone <joshua.i.stone@intel.com>
PR 3233
./
* stapfuncs.5.in: Document new gettimeofday_ns.
runtime/
* time.c (stp_time_t): Use ns for the base time, and freq is now kHz.
(__stp_estimate_cpufreq): Compute kHz instead of MHz.
(__stp_time_timer_callback, __stp_init_time): Compute base in ns.
(__stp_time_cpufreq_callback): Record kHz instead of MHz.
(_stp_init_time): Record kHz, and disable preemption to avoid a race
in the cpufreq notifier.
(_stp_gettimeofday_ns): Converted from _stp_gettimeofday_us.
tapset/
* timestamp.stp (gettimeofday_ns): New function
(gettimeofday_us, gettimeofday_ms, gettimeofday_s):
Use gettimeofday_ns as the base unit.
testsuite/
* buildok/timestamp.stp: add gettimeofday_ns test.
Diffstat (limited to 'tapset/timestamp.stp')
-rw-r--r-- | tapset/timestamp.stp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tapset/timestamp.stp b/tapset/timestamp.stp index d0c89df8..8db0faef 100644 --- a/tapset/timestamp.stp +++ b/tapset/timestamp.stp @@ -20,21 +20,26 @@ function get_cycles:long () %{ /* pure */ %} -// return in microseconds since epoch -function gettimeofday_us:long () %{ /* pure */ +// return in nanoseconds since epoch +function gettimeofday_ns:long () %{ /* pure */ /* NOTE: we can't use do_gettimeofday because we could be called from a * context where xtime_lock is already held. See bug #2525. */ - THIS->__retvalue = _stp_gettimeofday_us(); + THIS->__retvalue = _stp_gettimeofday_ns(); %} +// return in microseconds since epoch +function gettimeofday_us:long () { + return gettimeofday_ns() / 1000; +} + // return in milliseconds since epoch function gettimeofday_ms:long () { - return gettimeofday_us() / 1000; + return gettimeofday_ns() / 1000000; } // return in seconds since epoch function gettimeofday_s:long () { - return gettimeofday_us() / 1000000; + return gettimeofday_ns() / 1000000000; } // likewise jiffies, monotonic_clock ... |