summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorjistone <jistone>2006-06-30 23:47:02 +0000
committerjistone <jistone>2006-06-30 23:47:02 +0000
commita68f81a2b44b2e8737e953b774166d08721a1b63 (patch)
tree2fe2712fc5291937cd084e6c922c85a9b7803991 /tapsets.cxx
parentece0fed02ea52ba47993354000488f20dfb47848 (diff)
downloadsystemtap-steved-a68f81a2b44b2e8737e953b774166d08721a1b63.tar.gz
systemtap-steved-a68f81a2b44b2e8737e953b774166d08721a1b63.tar.xz
systemtap-steved-a68f81a2b44b2e8737e953b774166d08721a1b63.zip
2006-06-30 Josh Stone <joshua.i.stone@intel.com>
* tapsets.cxx (hrtimer_builder::build): Enable hrtimers on >=2.6.17. * tapsets.cxx (hrtimer_derived_probe::emit_probe_entries): Correct compilation errors, fix return value.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx25
1 files changed, 15 insertions, 10 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index afc430b2..6d9c8c00 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -4167,16 +4167,16 @@ hrtimer_derived_probe::emit_deregistrations (translator_output* o)
void
hrtimer_derived_probe::emit_probe_entries (translator_output* o)
{
- o->newline() << "static int enter_" << name << " (void *data);";
+ o->newline() << "static int enter_" << name << " (struct hrtimer *);";
o->newline() << "static struct hrtimer timer_" << name << ";";
- o->newline() << "int enter_" << name << " (void *data) {";
+ o->newline() << "int enter_" << name << " (struct hrtimer *timer) {";
o->indent(1);
o->newline() << "const char* probe_point = "
<< lex_cast_qstring(*locations[0]) << ";";
emit_probe_prologue (o, "STAP_SESSION_RUNNING");
- o->newline() << "(void) data;";
+ o->newline() << "(void) timer;";
o->newline() << "hrtimer_start (& timer_" << name << ", ";
emit_interval(o);
@@ -4186,7 +4186,9 @@ hrtimer_derived_probe::emit_probe_entries (translator_output* o)
o->newline() << name << " (c);";
emit_probe_epilogue (o);
- o->newline() << "return HRTIMER_RESTART;";
+
+ // Return NORESTART, because we already requeued the timer above
+ o->newline() << "return HRTIMER_NORESTART;";
o->newline(-1) << "}\n";
}
@@ -4223,12 +4225,15 @@ struct hrtimer_builder: public derived_probe_builder
string target_kernel_v;
- /*
- * When hrtimers are finally exported from the kernel, we can do a version
- * check against sess.kernel_release to enable them. Until then, just use
- * the "legacy" flavor.
- */
- if (0)
+ // cut off any release code suffix
+ string::size_type dash_index = sess.kernel_release.find ('-');
+ if (dash_index > 0 && dash_index != string::npos)
+ target_kernel_v = sess.kernel_release.substr (0, dash_index);
+ else
+ target_kernel_v = sess.kernel_release;
+
+ // hrtimers are only exported starting in 2.6.17
+ if (strverscmp(target_kernel_v.c_str(), "2.6.17") >= 0)
finished_results.push_back(
new hrtimer_derived_probe(base, location, i_ns, r_ns));
else