summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-11-20 16:20:13 -0500
committerFrank Ch. Eigler <fche@elastic.org>2008-11-20 16:20:13 -0500
commitd9582a605fc7710279b3504a7d6b37e8ee943c2a (patch)
tree04047f3f4ae39f25a7dbd17691b8b2e794629c5d
parent2ba3cb8b74da4baed86f917d3de8ea4d2935ac5a (diff)
downloadsystemtap-steved-d9582a605fc7710279b3504a7d6b37e8ee943c2a.tar.gz
systemtap-steved-d9582a605fc7710279b3504a7d6b37e8ee943c2a.tar.xz
systemtap-steved-d9582a605fc7710279b3504a7d6b37e8ee943c2a.zip
PR5689 part 1: per-global-variable skip tracking
-rw-r--r--ChangeLog6
-rw-r--r--translate.cxx23
2 files changed, 28 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d248018c..cf4f4611 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-11-20 Frank Ch. Eigler <fche@elastic.org>
+ PR 5689
+ * translate.cxx (emit_global, emit_global_init, emit_module_exit,
+ emit_locks): Track & print global.s_VAR_lock_skip_count.
+
+2008-11-20 Frank Ch. Eigler <fche@elastic.org>
+
* main.cxx (main): Correct thinko in --vp option with <5 arg chars.
2008-11-18 Jim Keniston <jkenisto@us.ibm.com>
diff --git a/translate.cxx b/translate.cxx
index 741455e0..0d4cc266 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -1043,6 +1043,9 @@ c_unparser::emit_global (vardecl *v)
else
o->newline() << "MAP s_" << vn << ";";
o->newline() << "rwlock_t s_" << vn << "_lock;";
+ o->newline() << "#ifdef STP_TIMING";
+ o->newline() << "atomic_t s_" << vn << "_lock_skip_count;";
+ o->newline() << "#endif" << endl;
}
@@ -1055,11 +1058,14 @@ c_unparser::emit_global_init (vardecl *v)
{
if (v->init)
{
- o->line() << ".s_" << vn << " = ";
+ o->newline() << ".s_" << vn << " = ";
v->init->visit(this);
o->line() << ",";
}
}
+ o->newline() << "#ifdef STP_TIMING";
+ o->newline() << ".s_" << vn << "_lock_skip_count = ATOMIC_INIT(0),";
+ o->newline() << "#endif";
}
@@ -1332,6 +1338,18 @@ c_unparser::emit_module_exit ()
<< "skipped probes: %d\\n\", "
<< "(int) atomic_read (& error_count), "
<< "(int) atomic_read (& skipped_count));";
+ o->newline() << "#ifdef STP_TIMING";
+ o->newline() << "{";
+ o->newline(1) << "int ctr;";
+ for (unsigned i=0; i<session->globals.size(); i++)
+ {
+ string vn = c_varname (session->globals[i]->name);
+ o->newline() << "ctr = atomic_read (& global.s_" << vn << "_lock_skip_count);";
+ o->newline() << "if (ctr) _stp_warn (\"Variable `%s' lock timeouts: %d\\n\", "
+ << lex_cast_qstring(vn) << ", ctr);";
+ }
+ o->newline(-1) << "}";
+ o->newline () << "#endif";
o->newline() << "_stp_print_flush();";
o->newline(-1) << "}";
o->newline(-1) << "}\n";
@@ -1625,6 +1643,9 @@ c_unparser::emit_locks(const varuse_collecting_visitor& vut)
o->newline(1) << "ndelay (TRYLOCKDELAY);";
o->newline(-1) << "if (unlikely (numtrylock >= MAXTRYLOCK)) {";
o->newline(1) << "atomic_inc (& skipped_count);";
+ o->newline() << "#ifdef STP_TIMING";
+ o->newline() << "atomic_inc (& global.s_" << c_varname (v->name) << "_lock_skip_count);";
+ o->newline() << "#endif";
// The following works even if i==0. Note that using
// globals[i-1]->name is wrong since that global may not have
// been lockworthy by this probe.