update compat
[lttv.git] / tags / lttv-0.10.0-pre15-12082008 / doc / developer / developer_guide / html / x33.html
CommitLineData
5750899b 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2<HTML
3><HEAD
4><TITLE
5>The hooks</TITLE
6><META
7NAME="GENERATOR"
8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9REL="HOME"
10TITLE="Linux Trace Toolkit Viewer Developer Guide"
11HREF="index.html"><LINK
12REL="UP"
13TITLE="Linux Trace Toolkit Viewer Text Module Tutorial"
14HREF="c18.html"><LINK
15REL="PREVIOUS"
16TITLE="A typical module"
17HREF="x23.html"><LINK
18REL="NEXT"
19TITLE="How to use the Linux Trace Toolkit Viewer's Reading Context"
20HREF="c40.html"></HEAD
21><BODY
22CLASS="sect1"
23BGCOLOR="#FFFFFF"
24TEXT="#000000"
25LINK="#0000FF"
26VLINK="#840084"
27ALINK="#0000FF"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>Linux Trace Toolkit Viewer Developer Guide</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="x23.html"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56>Chapter 1. Linux Trace Toolkit Viewer Text Module Tutorial</TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="c40.html"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><DIV
72CLASS="sect1"
73><H1
74CLASS="sect1"
75><A
76NAME="AEN33"
77>1.3. The hooks</A
78></H1
79><P
80>&#13;The before and after trace hooks only exists to be able to generate a report at
81the end of a trace computation. The effective computation is done by the event
82hooks.
83</P
84><P
85>&#13;These hooks does particular computation on data arriving as argument, a
86call_data. The type of the call_data, when a hook is called during the trace
87read, is a traceset context. It contains all the necessary information about the
88read in progress. This is the base class from which inherits trace set
89state, and trace set/trace/tracefile state is the base classe of trace
90set/trace/tracefile statistics. All these types can be casted to another without
91problem (a TracesetState, for example, can be casted to a TracesetContext, but
92it's not true for the casting between a TraceContext and a TracesetContext, see
93the chapter "How to use the trace reading context" for details). They offer the
94input data and they give a container (the attributes of the trace set/trace/tracefile
95statistics) to write the output of this hook.
96</P
97><P
98>&#13;The idea behind writing in the attributes container is to provide an extensible
99way of storing any type of information. For example, a specific module that adds
100statistics to a trace can store them there, and the statistic printout will
101automatically include the results produced by the specific module.
102</P
103><P
104>&#13;Output data does not necessarily need to be stored in such a global container
105though. If we think of data of which we need to keed track during the execution,
106an event counter for example, we should create our own data structure that
107contains this counter, and pass the address of the allocated structure as the
108hook_data parameter of the hook list creation function. That way, the hook will
109be called with its hook_data as first parameter, which it can read and write. We
110can think of this structure as the data related to the function that persists
111between each call to the hook. You must make sure that you cast the hook_data to
112the type of the structure before you use it in the hook function.
113</P
114><P
115>&#13;The detail about how to access the different fields of the reading context (the
116hook's call_data) will be discussed in the chapter "How to use the trace
117reading context".
118</P
119></DIV
120><DIV
121CLASS="NAVFOOTER"
122><HR
123ALIGN="LEFT"
124WIDTH="100%"><TABLE
125SUMMARY="Footer navigation table"
126WIDTH="100%"
127BORDER="0"
128CELLPADDING="0"
129CELLSPACING="0"
130><TR
131><TD
132WIDTH="33%"
133ALIGN="left"
134VALIGN="top"
135><A
136HREF="x23.html"
137ACCESSKEY="P"
138>Prev</A
139></TD
140><TD
141WIDTH="34%"
142ALIGN="center"
143VALIGN="top"
144><A
145HREF="index.html"
146ACCESSKEY="H"
147>Home</A
148></TD
149><TD
150WIDTH="33%"
151ALIGN="right"
152VALIGN="top"
153><A
154HREF="c40.html"
155ACCESSKEY="N"
156>Next</A
157></TD
158></TR
159><TR
160><TD
161WIDTH="33%"
162ALIGN="left"
163VALIGN="top"
164>A typical module</TD
165><TD
166WIDTH="34%"
167ALIGN="center"
168VALIGN="top"
169><A
170HREF="c18.html"
171ACCESSKEY="U"
172>Up</A
173></TD
174><TD
175WIDTH="33%"
176ALIGN="right"
177VALIGN="top"
178>How to use the Linux Trace Toolkit Viewer's Reading Context</TD
179></TR
180></TABLE
181></DIV
182></BODY
183></HTML
184>
This page took 0.030384 seconds and 4 git commands to generate.