summaryrefslogtreecommitdiffstats
path: root/tapset/indent.stp
diff options
context:
space:
mode:
authorfche <fche>2006-03-03 17:44:23 +0000
committerfche <fche>2006-03-03 17:44:23 +0000
commit4090de8ca2717fd028548f06783582b7c6c74931 (patch)
tree0c927c64a639400604312439d381af8bf3d03bdc /tapset/indent.stp
parentace00081c139d99e0229bb62534dfc6ba3a2bb02 (diff)
downloadsystemtap-steved-4090de8ca2717fd028548f06783582b7c6c74931.tar.gz
systemtap-steved-4090de8ca2717fd028548f06783582b7c6c74931.tar.xz
systemtap-steved-4090de8ca2717fd028548f06783582b7c6c74931.zip
2006-03-03 Frank Ch. Eigler <fche@elastic.org>
* tapset/indent.stp, indent-default.stp: New little tapset. * stapfuncs.5.in: Document it. * testsuite/buildok/indent.stp: Build it.
Diffstat (limited to 'tapset/indent.stp')
-rw-r--r--tapset/indent.stp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tapset/indent.stp b/tapset/indent.stp
new file mode 100644
index 00000000..dface781
--- /dev/null
+++ b/tapset/indent.stp
@@ -0,0 +1,22 @@
+global _indent_counters, _indent_timestamps
+
+function _generic_indent (idx, delta)
+{
+ ts = __indent_timestamp ()
+ if (! _indent_counters[idx]) _indent_timestamps[idx] = ts
+
+ # pre-increment for positive delta and post-decrement for negative delta
+ x = _indent_counters[idx] + (delta > 0 ? delta : 0)
+ _indent_counters[idx] += delta
+
+ r = sprintf("%6d %s(%d):", (ts - _indent_timestamps[idx]),
+ execname(), tid())
+ for (i=1; i<x; i++) r .= " "
+
+ return r
+}
+
+function thread_indent (delta)
+{
+ return _generic_indent (tid(), delta)
+}