diff options
author | Breno Leitao <leitao@linux.vnet.ibm.com> | 2009-10-01 00:09:07 -0300 |
---|---|---|
committer | Breno Leitao <leitao@linux.vnet.ibm.com> | 2009-10-01 00:09:07 -0300 |
commit | 2fd689d98a1c6bd24486e8e261e52bf0814dd477 (patch) | |
tree | 5f85361b72b2602d7d24bb46419056cee78afbf2 /tapset | |
parent | 468abaf4588392bcf7d7e243c707bb41bc17532c (diff) | |
download | systemtap-steved-2fd689d98a1c6bd24486e8e261e52bf0814dd477.tar.gz systemtap-steved-2fd689d98a1c6bd24486e8e261e52bf0814dd477.tar.xz systemtap-steved-2fd689d98a1c6bd24486e8e261e52bf0814dd477.zip |
Actually indent_thread() is a very useful function, but
sometimes you're probing something that is not related to
any task, as an interrupt function, and if the application
changes during the interrupt, the indentation gets confused.
For example:
0 swapper(0): -> neo_copy_data_from_queue_to_uart
69 a.out(7659): -> neo_parse_modem
74 a.out(7659): -> neo_param
14 swapper(0): <- neo_copy_data_from_queue_to_uart
83 a.out(7659): -> jsm_carrier
86 a.out(7659): <- jsm_carrier
0 swapper(0): -> neo_parse_modem
94 a.out(7659): <- jsm_tty_set_termios
8 swapper(0): <- neo_parse_modem
So, I decided to create a simpler function that doesn't
consider the task.
Much of the idea of this implementation came from Frank(Thanks)
Diffstat (limited to 'tapset')
-rw-r--r-- | tapset/indent.stp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tapset/indent.stp b/tapset/indent.stp index dface781..1dbbebd4 100644 --- a/tapset/indent.stp +++ b/tapset/indent.stp @@ -1,6 +1,6 @@ global _indent_counters, _indent_timestamps -function _generic_indent (idx, delta) +function _generic_indent (idx, desc, delta) { ts = __indent_timestamp () if (! _indent_counters[idx]) _indent_timestamps[idx] = ts @@ -9,14 +9,26 @@ function _generic_indent (idx, delta) x = _indent_counters[idx] + (delta > 0 ? delta : 0) _indent_counters[idx] += delta - r = sprintf("%6d %s(%d):", (ts - _indent_timestamps[idx]), - execname(), tid()) + r = sprintf("%6d %s:", (ts - _indent_timestamps[idx]), desc) + for (i=1; i<x; i++) r .= " " return r } +/** + * sfunction thread_indent - returns an amount of space with the current task information + * @delta: the amount of space added/removed for each call + */ function thread_indent (delta) { - return _generic_indent (tid(), delta) + return _generic_indent (tid(), sprintf("%s(%d)", execname(), tid()), delta) +} + +/** + * sfunction indent - returns an amount of space to indent + * @delta: the amount of space added/removed for each call + */ +function indent(delta){ + return _generic_indent(-1, "", delta) } |