From 602149dadba5e74e6de8b5a172a64b13dcce6f1d Mon Sep 17 00:00:00 2001 From: fche Date: Wed, 22 Feb 2006 18:19:11 +0000 Subject: 2006-02-22 Frank Ch. Eigler * stapfuncs.5.in: Document get_cycles(). * testsuite/buildok/timestamp.stp: Build it and its friends. 2006-02-22 Frank Ch. Eigler * timestamp.stp (get_cycles): New function. --- ChangeLog | 5 +++++ stapfuncs.5.in | 3 +++ tapset/ChangeLog | 4 ++++ tapset/timestamp.stp | 9 ++++++++- testsuite/buildok/timestamp.stp | 6 ++++++ 5 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 testsuite/buildok/timestamp.stp diff --git a/ChangeLog b/ChangeLog index 31edfa56..4f1bdc0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-02-22 Frank Ch. Eigler + + * stapfuncs.5.in: Document get_cycles(). + * testsuite/buildok/timestamp.stp: Build it and its friends. + 2006-02-22 Frank Ch. Eigler PR 2293. 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 + + * timestamp.stp (get_cycles): New function. + 2006-02-21 Martin Hunt * 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())) +} -- cgit