]> sourceware.org Git - systemtap.git/commitdiff
2005-08-11 Frank Ch. Eigler <fche@elastic.org>
authorfche <fche>
Thu, 11 Aug 2005 16:53:45 +0000 (16:53 +0000)
committerfche <fche>
Thu, 11 Aug 2005 16:53:45 +0000 (16:53 +0000)
* 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.

ChangeLog
tapset/builtin_conversions.stp [new file with mode: 0644]
tapset/builtin_hexstring.stp [deleted file]
tapset/builtin_log.stp [deleted file]
tapset/builtin_logging.stp [new file with mode: 0644]
tapset/builtin_printk.stp [deleted file]
tapset/builtin_string.stp [deleted file]
tapset/builtin_warn.stp [deleted file]
tapset/timestamp_functions.stp [new file with mode: 0644]
translate.cxx

index a01ea51e55ee13c50c960f633156f825a23d0871..ceb87964bc27845cd7c7fc3d475112089034094e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
 2005-08-11  Frank Ch. Eigler  <fche@elastic.org>
 
        * tapsets.cxx: Tweak hex/decimal printing for consistency.
diff --git a/tapset/builtin_conversions.stp b/tapset/builtin_conversions.stp
new file mode 100644 (file)
index 0000000..5c0230d
--- /dev/null
@@ -0,0 +1,14 @@
+function _hexstring (num) %{
+    sprintf (THIS->__retvalue, "0x%llx", (long long) THIS->num);
+%}
+
+function hexstring (num) {
+    return "" . _hexstring (num + 0)
+}
+function _string (num) %{
+    sprintf (THIS->__retvalue, "%lld", (long long) THIS->num);
+%}
+
+function string (num) {
+    return "" . _string (num + 0)
+}
diff --git a/tapset/builtin_hexstring.stp b/tapset/builtin_hexstring.stp
deleted file mode 100644 (file)
index c441bbc..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-function _hexstring (num) %{
-    sprintf (THIS->__retvalue, "%llx", (long long) THIS->num);
-%}
-
-function hexstring (num) {
-    return "" . _hexstring (num + 0)
-}
diff --git a/tapset/builtin_log.stp b/tapset/builtin_log.stp
deleted file mode 100644 (file)
index 3d1a0aa..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-function _log (msg) %{
-    _stp_log (THIS->msg);
-%}
-
-function log (msg) {
-   _log (msg . "")
-}
diff --git a/tapset/builtin_logging.stp b/tapset/builtin_logging.stp
new file mode 100644 (file)
index 0000000..51fb97e
--- /dev/null
@@ -0,0 +1,21 @@
+function _log (msg) %{
+    _stp_log (THIS->msg);
+%}
+
+function log (msg) {
+   _log (msg . "")
+}
+function _printk (msg) %{
+    printk (KERN_INFO "%s\n", THIS->msg);
+%}
+
+function printk (msg) {
+    _printk (msg . "")
+}
+function _warn (msg) %{
+    _stp_warn (THIS->msg);
+%}
+
+function warn (msg) {
+    _warn (msg . "")
+}
diff --git a/tapset/builtin_printk.stp b/tapset/builtin_printk.stp
deleted file mode 100644 (file)
index 8182684..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-function _printk (msg) %{
-    printk (KERN_INFO "%s\n", THIS->msg);
-%}
-
-function printk (msg) {
-    _printk (msg . "")
-}
diff --git a/tapset/builtin_string.stp b/tapset/builtin_string.stp
deleted file mode 100644 (file)
index d068feb..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-function _string (num) %{
-    sprintf (THIS->__retvalue, "%lld", (long long) THIS->num);
-%}
-
-function string (num) {
-    return "" . _string (num + 0)
-}
diff --git a/tapset/builtin_warn.stp b/tapset/builtin_warn.stp
deleted file mode 100644 (file)
index 97289ee..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-function _warn (msg) %{
-    _stp_warn (THIS->msg);
-%}
-
-function warn (msg) {
-    _warn (msg . "")
-}
diff --git a/tapset/timestamp_functions.stp b/tapset/timestamp_functions.stp
new file mode 100644 (file)
index 0000000..f8e1ea4
--- /dev/null
@@ -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 ...
index 8806e502367c6eee3e9243fa757d8011017a6c02..b2a44563da0ee97a55d87fe4199a54e64e7f70d4 100644 (file)
@@ -771,7 +771,10 @@ c_unparser::emit_function (functiondecl* v)
       o->newline() << retvalue.init();
     }
 
+  o->newline(1) << "{"; // in case body is embeddedcode with decls
   v->body->visit (this);
+  o->newline(-1) << "}";
+
   this->current_function = 0;
 
   o->newline(-1) << "out:";
This page took 0.041778 seconds and 5 git commands to generate.