summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2005-09-07 02:16:59 +0000
committerfche <fche>2005-09-07 02:16:59 +0000
commitff17e83089dee8d23e51cf55f8ea3a28c07dedee (patch)
treeafd37ba5838c793f80f83f550dd91148474c435a
parent5d64f5e78eab3b1eeccca5c91aa50f8414c1e878 (diff)
downloadsystemtap-steved-ff17e83089dee8d23e51cf55f8ea3a28c07dedee.tar.gz
systemtap-steved-ff17e83089dee8d23e51cf55f8ea3a28c07dedee.tar.xz
systemtap-steved-ff17e83089dee8d23e51cf55f8ea3a28c07dedee.zip
2005-09-06 Frank Ch. Eigler <fche@elastic.org>
* stap.1.in: Clarify absence of short-circuiting in && and ||. * translate.cxx (emit_function): Improve "array locals" message. * tapset/timestamp.stp: Add gettimeofday_us function. Correct arithmetic typing in other functions. * stapfuncs.5.in: Document new function.
-rw-r--r--ChangeLog8
-rw-r--r--stap.1.in4
-rw-r--r--stapfuncs.5.in4
-rw-r--r--tapset/timestamp.stp10
-rw-r--r--translate.cxx2
5 files changed, 25 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ed873879..3d526236 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-09-06 Frank Ch. Eigler <fche@elastic.org>
+
+ * stap.1.in: Clarify absence of short-circuiting in && and ||.
+ * translate.cxx (emit_function): Improve "array locals" message.
+ * tapset/timestamp.stp: Add gettimeofday_us function. Correct
+ arithmetic typing in other functions.
+ * stapfuncs.5.in: Document new function.
+
2005-09-06 Martin Hunt <hunt@redhat.com>
* systemtap.spec.in: Bump elfutils_version to .115.
diff --git a/stap.1.in b/stap.1.in
index a2b3fb47..7ceb843c 100644
--- a/stap.1.in
+++ b/stap.1.in
@@ -219,7 +219,9 @@ Return now from enclosing probe handler.
.SS EXPRESSIONS
Systemtap supports a number of operators that have the same general syntax,
semantics, and precedence as in C and awk. Arithmetic is performed as per
-C rules. Division by zero is detected and results in an error.
+typical C rules for signed integers. No short-circuiting is performed
+for the boolean operations. Division by zero is detected and results in
+an error.
.TP
binary numeric operators
.B * / % + - >> << & ^ | && ||
diff --git a/stapfuncs.5.in b/stapfuncs.5.in
index 77514e28..f883a8ad 100644
--- a/stapfuncs.5.in
+++ b/stapfuncs.5.in
@@ -87,6 +87,10 @@ address is only partial at present.
.SS TIMESTAMP
.TP
+gettimeofday_us:long ()
+Return the number of microseconds since the UNIX epoch.
+
+.TP
gettimeofday_ms:long ()
Return the number of milliseconds since the UNIX epoch.
diff --git a/tapset/timestamp.stp b/tapset/timestamp.stp
index b71841d4..8b8aa3f2 100644
--- a/tapset/timestamp.stp
+++ b/tapset/timestamp.stp
@@ -2,11 +2,19 @@
#include <linux/time.h>
%}
+
+// return in microseconds since epoch
+function gettimeofday_us:long () %{
+ struct timeval tm;
+ do_gettimeofday (& tm);
+ THIS->__retvalue = (tm.tv_sec * 1000000ULL) + (tm.tv_usec);
+%}
+
// return in milliseconds since epoch
function gettimeofday_ms:long () %{
struct timeval tm;
do_gettimeofday (& tm);
- THIS->__retvalue = (tm.tv_sec * 1000) + (tm.tv_usec / 1000);
+ THIS->__retvalue = (tm.tv_sec * 1000ULL) + (tm.tv_usec / 1000);
%}
// return in seconds since epoch
diff --git a/translate.cxx b/translate.cxx
index cca6cad6..6b00cd9e 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -849,7 +849,7 @@ c_unparser::emit_function (functiondecl* v)
for (unsigned i=0; i<v->locals.size(); i++)
{
if (v->locals[i]->index_types.size() > 0) // array?
- throw semantic_error ("array locals not supported", v->tok);
+ throw semantic_error ("array locals not supported", v->locals[i]->tok);
o->newline() << getvar (v->locals[i]).init();
}