summaryrefslogtreecommitdiffstats
path: root/tapset/timestamp_functions.stp
diff options
context:
space:
mode:
authorfche <fche>2005-08-11 16:53:45 +0000
committerfche <fche>2005-08-11 16:53:45 +0000
commit0d155048397c88db09a25989450568e25af8f44c (patch)
tree3fe59a1997c04f4e46839d9b687520fd6419fc82 /tapset/timestamp_functions.stp
parent59ff27737b1c61f995ec5975f947d9a51c5667ad (diff)
downloadsystemtap-steved-0d155048397c88db09a25989450568e25af8f44c.tar.gz
systemtap-steved-0d155048397c88db09a25989450568e25af8f44c.tar.xz
systemtap-steved-0d155048397c88db09a25989450568e25af8f44c.zip
2005-08-11 Frank Ch. Eigler <fche@elastic.org>
* translate.cxx (emit_function): Add an extra { } around the function body visitation. * tapset/timestamp_functions.stp: New file. * tapset/builtin_conversions.stp: Aggregated from [hex]string. * tapset/builtin_logging.stp: Aggregated from log/warn/printk.
Diffstat (limited to 'tapset/timestamp_functions.stp')
-rw-r--r--tapset/timestamp_functions.stp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tapset/timestamp_functions.stp b/tapset/timestamp_functions.stp
new file mode 100644
index 00000000..f8e1ea4e
--- /dev/null
+++ b/tapset/timestamp_functions.stp
@@ -0,0 +1,19 @@
+%{
+#include <linux/time.h>
+%}
+
+// return in milliseconds since epoch
+function gettimeofday_ms () %{
+ struct timeval tm;
+ do_gettimeofday (& tm);
+ THIS->__retvalue = (tm.tv_sec * 1000) + (tm.tv_usec / 1000);
+%}
+
+// return in seconds since epoch
+function gettimeofday_s () %{
+ struct timeval tm;
+ do_gettimeofday (& tm);
+ THIS->__retvalue = tm.tv_sec;
+%}
+
+// likewise jiffies, monotonic_clock ...