1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
8 CONTENT=
"Modular DocBook HTML Stylesheet Version 1.79"><LINK
10 TITLE=
"Linux Trace Toolkit Viewer Developer Guide"
11 HREF=
"index.html"><LINK
13 TITLE=
"Linux Trace Toolkit Viewer Text Module Tutorial"
16 TITLE=
"A typical module"
19 TITLE=
"How to use the Linux Trace Toolkit Viewer's Reading Context"
20 HREF=
"c40.html"></HEAD
31 SUMMARY=
"Header navigation table"
40 >Linux Trace Toolkit Viewer Developer Guide
</TH
56 >Chapter
1. Linux Trace Toolkit Viewer Text Module Tutorial
</TD
80 > The before and after trace hooks only exists to be able to generate a report at
81 the end of a trace computation. The effective computation is done by the event
85 > These hooks does particular computation on data arriving as argument, a
86 call_data. The type of the call_data, when a hook is called during the trace
87 read, is a traceset context. It contains all the necessary information about the
88 read in progress. This is the base class from which inherits trace set
89 state, and trace set/trace/tracefile state is the base classe of trace
90 set/trace/tracefile statistics. All these types can be casted to another without
91 problem (a TracesetState, for example, can be casted to a TracesetContext, but
92 it's not true for the casting between a TraceContext and a TracesetContext, see
93 the chapter
"How to use the trace reading context" for details). They offer the
94 input data and they give a container (the attributes of the trace set/trace/tracefile
95 statistics) to write the output of this hook.
98 > The idea behind writing in the attributes container is to provide an extensible
99 way of storing any type of information. For example, a specific module that adds
100 statistics to a trace can store them there, and the statistic printout will
101 automatically include the results produced by the specific module.
104 > Output data does not necessarily need to be stored in such a global container
105 though. If we think of data of which we need to keed track during the execution,
106 an event counter for example, we should create our own data structure that
107 contains this counter, and pass the address of the allocated structure as the
108 hook_data parameter of the hook list creation function. That way, the hook will
109 be called with its hook_data as first parameter, which it can read and write. We
110 can think of this structure as the data related to the function that persists
111 between each call to the hook. You must make sure that you cast the hook_data to
112 the type of the structure before you use it in the hook function.
115 > The detail about how to access the different fields of the reading context (the
116 hook's call_data) will be discussed in the chapter
"How to use the trace
125 SUMMARY=
"Footer navigation table"
164 >A typical module
</TD
178 >How to use the Linux Trace Toolkit Viewer's Reading Context
</TD