summaryrefslogtreecommitdiffstats
path: root/translate.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'translate.cxx')
-rw-r--r--translate.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/translate.cxx b/translate.cxx
index 62c71aeb..9f45f5d1 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -1133,6 +1133,15 @@ c_unparser::emit_module_init ()
o->newline(-1) << "}";
o->newline() << "if (rc) goto out;";
+ // initialize gettimeofday (if needed)
+ o->newline() << "#ifdef STAP_NEED_GETTIMEOFDAY";
+ o->newline() << "rc = _stp_init_time();"; // Kick off the Big Bang.
+ o->newline() << "if (rc) {";
+ o->newline(1) << "_stp_error (\"couldn't initialize gettimeofday\");";
+ o->newline() << "goto out;";
+ o->newline(-1) << "}";
+ o->newline() << "#endif";
+
o->newline() << "(void) probe_point;";
o->newline() << "(void) i;";
o->newline() << "(void) j;";
@@ -1359,6 +1368,11 @@ c_unparser::emit_module_exit ()
o->newline() << "#endif";
}
+ // teardown gettimeofday (if needed)
+ o->newline() << "#ifdef STAP_NEED_GETTIMEOFDAY";
+ o->newline() << " _stp_kill_time();"; // Go to a beach. Drink a beer.
+ o->newline() << "#endif";
+
// print final error/skipped counts if non-zero
o->newline() << "if (atomic_read (& skipped_count) || "
<< "atomic_read (& error_count) || "