| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ |
| 3 |
]> |
| 4 |
|
| 5 |
|
| 6 |
<section id="paracallgraph"> |
| 7 |
<title>Call Graph Tracing</title> |
| 8 |
|
| 9 |
<indexterm> |
| 10 |
<primary>script examples</primary> |
| 11 |
<secondary>call graph tracing</secondary> |
| 12 |
</indexterm> |
| 13 |
|
| 14 |
<indexterm> |
| 15 |
<primary>examples of SystemTap scripts</primary> |
| 16 |
<secondary>call graph tracing</secondary> |
| 17 |
</indexterm> |
| 18 |
|
| 19 |
<indexterm> |
| 20 |
<primary>call graph tracing</primary> |
| 21 |
<secondary>examples of SystemTap scripts</secondary> |
| 22 |
</indexterm> |
| 23 |
|
| 24 |
<indexterm> |
| 25 |
<primary>incoming/outgoing function calls, tracing</primary> |
| 26 |
<secondary>examples of SystemTap scripts</secondary> |
| 27 |
</indexterm> |
| 28 |
<indexterm> |
| 29 |
<primary>function calls (incoming/outgoing), tracing</primary> |
| 30 |
<secondary>examples of SystemTap scripts</secondary> |
| 31 |
</indexterm> |
| 32 |
<indexterm> |
| 33 |
<primary>tracing incoming/outgoing function calls</primary> |
| 34 |
<secondary>examples of SystemTap scripts</secondary> |
| 35 |
</indexterm> |
| 36 |
<indexterm> |
| 37 |
<primary>tracing call graph</primary> |
| 38 |
<secondary>examples of SystemTap scripts</secondary> |
| 39 |
</indexterm> |
| 40 |
|
| 41 |
<remark> |
| 42 |
WAR STORY: Call graph tracing http://sourceware.org/systemtap/wiki/WSCallGraph?highlight=((WarStories)) |
| 43 |
</remark> |
| 44 |
|
| 45 |
<remark> |
| 46 |
script: http://sourceware.org/systemtap/examples/general/para-callgraph.stp |
| 47 |
</remark> |
| 48 |
|
| 49 |
|
| 50 |
<para>This section describes how to trace incoming and outgoing function calls. </para> |
| 51 |
|
| 52 |
<formalpara id="scriptcallgraph"> |
| 53 |
<title>para-callgraph.stp</title> |
| 54 |
<para> |
| 55 |
<programlisting><xi:include parse="text" href="../testsuite/systemtap.examples/general/para-callgraph.stp" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting> |
| 56 |
</para> |
| 57 |
</formalpara> |
| 58 |
<indexterm> |
| 59 |
<primary>script examples</primary> |
| 60 |
<secondary>multiple command-line arguments, example of</secondary> |
| 61 |
</indexterm> |
| 62 |
|
| 63 |
<indexterm> |
| 64 |
<primary>examples of SystemTap scripts</primary> |
| 65 |
<secondary>multiple command-line arguments, example of</secondary> |
| 66 |
</indexterm> |
| 67 |
|
| 68 |
<indexterm> |
| 69 |
<primary>multiple command-line arguments, example of</primary> |
| 70 |
<secondary>examples of SystemTap scripts</secondary> |
| 71 |
</indexterm> |
| 72 |
<indexterm> |
| 73 |
<primary>example of multiple command-line arguments</primary> |
| 74 |
<secondary>examples of SystemTap scripts</secondary> |
| 75 |
</indexterm> |
| 76 |
|
| 77 |
<para><xref linkend="scriptcallgraph"/> takes two command-line arguments:</para> |
| 78 |
<indexterm> |
| 79 |
<primary>script examples</primary> |
| 80 |
<secondary>trigger function</secondary> |
| 81 |
</indexterm> |
| 82 |
|
| 83 |
<indexterm> |
| 84 |
<primary>examples of SystemTap scripts</primary> |
| 85 |
<secondary>trigger function</secondary> |
| 86 |
</indexterm> |
| 87 |
|
| 88 |
<indexterm> |
| 89 |
<primary>trigger function</primary> |
| 90 |
<secondary>examples of SystemTap scripts</secondary> |
| 91 |
</indexterm> |
| 92 |
<itemizedlist> |
| 93 |
<listitem><para> |
| 94 |
The function/s whose entry/exit call you'd like to trace |
| 95 |
(<command>$1</command>). |
| 96 |
</para></listitem> |
| 97 |
|
| 98 |
<listitem><para> |
| 99 |
A second optional <firstterm>trigger function</firstterm> (<command>$2</command>), which |
| 100 |
enables or disables tracing on a per-thread basis. Tracing in each thread |
| 101 |
will continue as long as the trigger function has not exited yet. |
| 102 |
</para></listitem> |
| 103 |
|
| 104 |
</itemizedlist> |
| 105 |
|
| 106 |
<remark> please verify previous if correct; i'm particularly interested in finding out how to better describe "trigger function"</remark> |
| 107 |
<indexterm> |
| 108 |
<primary>script examples</primary> |
| 109 |
<secondary>thread_indent(), sample usage</secondary> |
| 110 |
</indexterm> |
| 111 |
|
| 112 |
<indexterm> |
| 113 |
<primary>examples of SystemTap scripts</primary> |
| 114 |
<secondary>thread_indent(), sample usage</secondary> |
| 115 |
</indexterm> |
| 116 |
|
| 117 |
<indexterm> |
| 118 |
<primary>thread_indent(), sample usage</primary> |
| 119 |
<secondary>examples of SystemTap scripts</secondary> |
| 120 |
</indexterm> |
| 121 |
|
| 122 |
<para><xref linkend="scriptcallgraph"/> uses <command>thread_indent()</command>; as such, its output contains the timestamp, process name, and thread ID of <command>$1</command> (that is, the probe function you are tracing). For more information about <command>thread_indent()</command>, refer to its entry in <xref linkend="systemtapscript-functions"/>.</para> |
| 123 |
|
| 124 |
<para>The following example contains an excerpt from the output |
| 125 |
for <command>stap para-callgraph.stp 'kernel.function("*@fs/*.c")' 'kernel.function("sys_read")'</command>:</para> |
| 126 |
|
| 127 |
|
| 128 |
<example id="paracallgraphoutput"> |
| 129 |
<title><xref linkend="scriptcallgraph"/> Sample Output</title> |
| 130 |
<screen>[...] |
| 131 |
267 gnome-terminal(2921): <-do_sync_read return=0xfffffffffffffff5 |
| 132 |
269 gnome-terminal(2921):<-vfs_read return=0xfffffffffffffff5 |
| 133 |
0 gnome-terminal(2921):->fput file=0xffff880111eebbc0 |
| 134 |
2 gnome-terminal(2921):<-fput |
| 135 |
0 gnome-terminal(2921):->fget_light fd=0x3 fput_needed=0xffff88010544df54 |
| 136 |
3 gnome-terminal(2921):<-fget_light return=0xffff8801116ce980 |
| 137 |
0 gnome-terminal(2921):->vfs_read file=0xffff8801116ce980 buf=0xc86504 count=0x1000 pos=0xffff88010544df48 |
| 138 |
4 gnome-terminal(2921): ->rw_verify_area read_write=0x0 file=0xffff8801116ce980 ppos=0xffff88010544df48 count=0x1000 |
| 139 |
7 gnome-terminal(2921): <-rw_verify_area return=0x1000 |
| 140 |
12 gnome-terminal(2921): ->do_sync_read filp=0xffff8801116ce980 buf=0xc86504 len=0x1000 ppos=0xffff88010544df48 |
| 141 |
15 gnome-terminal(2921): <-do_sync_read return=0xfffffffffffffff5 |
| 142 |
18 gnome-terminal(2921):<-vfs_read return=0xfffffffffffffff5 |
| 143 |
0 gnome-terminal(2921):->fput file=0xffff8801116ce980</screen> |
| 144 |
</example> |
| 145 |
|
| 146 |
</section> |
| 147 |
|