]> sourceware.org Git - systemtap.git/commitdiff
PR16472: Add a thread_indent_depth() tapset function
authorFahad Arshad <fahadaliarshad@gmail.com>
Wed, 26 Feb 2014 14:41:05 +0000 (09:41 -0500)
committerJosh Stone <jistone@redhat.com>
Wed, 26 Feb 2014 22:55:22 +0000 (14:55 -0800)
tapset/indent.stp

index bc608461ba6e91a1015641f52aa2eac8fb55aab3..33bb98d1fdabe79364f3ca35ebd90cc5b711acba 100644 (file)
@@ -36,6 +36,30 @@ function thread_indent:string (delta:long)
   return _generic_indent (tid(), sprintf("%s(%d)", execname(), tid()), delta)
 }
 
+function _generic_indent_depth:long (idx, delta) 
+{
+  # pre-increment for positive delta and post-decrement for negative delta
+  x = _indent_counters[idx] + (delta > 0 ? delta : 0)
+  _indent_counters[idx] += delta
+
+  return (x>0 ? x-1 : 0)
+}
+
+/**
+ * sfunction thread_indent_depth - returns an integer corresponding to the nested-depth in the current task information
+ *
+ * @delta: the amount of increment added/removed for each call
+ *
+ * Description: This function returns an integer equal to the nested function-call depth starting 
+ * from the outermost initial level. This function is useful for saving space (consumed by whitespace)
+ * in traces with long nested function calls. Use this function in a similar fashion to thread_indent(), i.e.,
+ * in call-probe, use thread_indent_depth(1) and in return-probe, use thread_indent_depth(-1)
+ */
+function thread_indent_depth:long (delta:long)
+{
+  return _generic_indent_depth (tid(), delta)
+}
+
 /**
  * sfunction indent - returns an amount of space to indent
  *
This page took 0.028035 seconds and 5 git commands to generate.