summaryrefslogtreecommitdiffstats
path: root/tapset/timestamp.stp
diff options
context:
space:
mode:
authorjistone <jistone>2006-06-22 00:48:33 +0000
committerjistone <jistone>2006-06-22 00:48:33 +0000
commitf0278305cd0e133902f9d9f64493063cde41e49d (patch)
tree5ec98c62cdee3fbd9a4267c05d9eab07a728bfa0 /tapset/timestamp.stp
parentedaa31752b40245cfc3e3fc966353ba2f120525a (diff)
downloadsystemtap-steved-f0278305cd0e133902f9d9f64493063cde41e49d.tar.gz
systemtap-steved-f0278305cd0e133902f9d9f64493063cde41e49d.tar.xz
systemtap-steved-f0278305cd0e133902f9d9f64493063cde41e49d.zip
2006-06-21 Josh Stone <joshua.i.stone@intel.com>
runtime/ * time.c: Time-estimation with minimal dependency on xtime. runtime/transport/ * transport/transport.c (_stp_handle_start): Initialize timer functions. * transport.c (_stp_cleanup_and_exit): Teardown timer functions. tapset/ * timestamp.stp (gettimeofday_us, gettimeofday_ms, gettimeofday_s): Convert to using the runtime-provided _stp_gettimeofday_us().
Diffstat (limited to 'tapset/timestamp.stp')
-rw-r--r--tapset/timestamp.stp23
1 files changed, 10 insertions, 13 deletions
diff --git a/tapset/timestamp.stp b/tapset/timestamp.stp
index 67e2e73a..d0c89df8 100644
--- a/tapset/timestamp.stp
+++ b/tapset/timestamp.stp
@@ -1,5 +1,6 @@
// timestamp tapset
// Copyright (C) 2005-2006 Red Hat Inc.
+// Copyright (C) 2006 Intel Corporation.
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
@@ -21,23 +22,19 @@ function get_cycles:long () %{ /* pure */
// return in microseconds since epoch
function gettimeofday_us:long () %{ /* pure */
- struct timeval tm;
- do_gettimeofday (& tm);
- THIS->__retvalue = (tm.tv_sec * 1000000ULL) + (tm.tv_usec);
+ /* 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();
%}
// return in milliseconds since epoch
-function gettimeofday_ms:long () %{ /* pure */
- struct timeval tm;
- do_gettimeofday (& tm);
- THIS->__retvalue = (tm.tv_sec * 1000ULL) + (tm.tv_usec / 1000);
-%}
+function gettimeofday_ms:long () {
+ return gettimeofday_us() / 1000;
+}
// return in seconds since epoch
-function gettimeofday_s:long () %{ /* pure */
- struct timeval tm;
- do_gettimeofday (& tm);
- THIS->__retvalue = tm.tv_sec;
-%}
+function gettimeofday_s:long () {
+ return gettimeofday_us() / 1000000;
+}
// likewise jiffies, monotonic_clock ...