From f0278305cd0e133902f9d9f64493063cde41e49d Mon Sep 17 00:00:00 2001 From: jistone Date: Thu, 22 Jun 2006 00:48:33 +0000 Subject: 2006-06-21 Josh Stone 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(). --- tapset/timestamp.stp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'tapset/timestamp.stp') 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 ... -- cgit