diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | stapfuncs.5.in | 3 | ||||
-rw-r--r-- | tapset/ChangeLog | 4 | ||||
-rw-r--r-- | tapset/timestamp.stp | 9 | ||||
-rwxr-xr-x | testsuite/buildok/timestamp.stp | 6 |
5 files changed, 26 insertions, 1 deletions
@@ -1,5 +1,10 @@ 2006-02-22 Frank Ch. Eigler <fche@elastic.org> + * stapfuncs.5.in: Document get_cycles(). + * testsuite/buildok/timestamp.stp: Build it and its friends. + +2006-02-22 Frank Ch. Eigler <fche@elastic.org> + PR 2293. * tapsets.cxx (emit_probe_epilogue): Emit early local_irq_save(). (emit_probe_epilogue): ... and matching _restore(). diff --git a/stapfuncs.5.in b/stapfuncs.5.in index 04ada825..e1337993 100644 --- a/stapfuncs.5.in +++ b/stapfuncs.5.in @@ -94,6 +94,9 @@ Return 1 if string s1 contains string s2, returns 0 otherwise. .SS TIMESTAMP .TP +get_cycles:long () +Return the processor cycle counter value, or 0 if unavailable. +.TP gettimeofday_us:long () Return the number of microseconds since the UNIX epoch. .TP diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 00171e6b..012ed16f 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,7 @@ +2006-02-22 Frank Ch. Eigler <fche@elastic.org> + + * timestamp.stp (get_cycles): New function. + 2006-02-21 Martin Hunt <hunt@redhat.com> * context.stp: Fix definition of returnval(). Now the same as retval(). diff --git a/tapset/timestamp.stp b/tapset/timestamp.stp index 009e1112..ee9478cb 100644 --- a/tapset/timestamp.stp +++ b/tapset/timestamp.stp @@ -1,5 +1,5 @@ // timestamp tapset -// Copyright (C) 2005 Red Hat Inc. +// Copyright (C) 2005-2006 Red Hat Inc. // // 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 @@ -12,6 +12,13 @@ %} +// return processor cycle counter (if any) +function get_cycles:long () %{ + cycles_t c = get_cycles(); + THIS->__retvalue = (int64_t) c; +%} + + // return in microseconds since epoch function gettimeofday_us:long () %{ struct timeval tm; diff --git a/testsuite/buildok/timestamp.stp b/testsuite/buildok/timestamp.stp new file mode 100755 index 00000000..f273262f --- /dev/null +++ b/testsuite/buildok/timestamp.stp @@ -0,0 +1,6 @@ +#! stap -p4 + +probe begin { + log(string(get_cycles() + gettimeofday_us() + + gettimeofday_ms() + gettimeofday_s())) +} |