| 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 | >Using the reading context</TITLE |
| 6 | ><META |
| 7 | NAME="GENERATOR" |
| 8 | CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK |
| 9 | REL="HOME" |
| 10 | TITLE="Linux Trace Toolkit Viewer Developer Guide" |
| 11 | HREF="index.html"><LINK |
| 12 | REL="UP" |
| 13 | TITLE="How to use the Linux Trace Toolkit Viewer's Reading Context" |
| 14 | HREF="c40.html"><LINK |
| 15 | REL="PREVIOUS" |
| 16 | TITLE="Why an event driven trace reader ?" |
| 17 | HREF="x46.html"><LINK |
| 18 | REL="NEXT" |
| 19 | TITLE="Linux Trace Toolkit Viewer Graphical Module Tutorial" |
| 20 | HREF="c67.html"></HEAD |
| 21 | ><BODY |
| 22 | CLASS="sect1" |
| 23 | BGCOLOR="#FFFFFF" |
| 24 | TEXT="#000000" |
| 25 | LINK="#0000FF" |
| 26 | VLINK="#840084" |
| 27 | ALINK="#0000FF" |
| 28 | ><DIV |
| 29 | CLASS="NAVHEADER" |
| 30 | ><TABLE |
| 31 | SUMMARY="Header navigation table" |
| 32 | WIDTH="100%" |
| 33 | BORDER="0" |
| 34 | CELLPADDING="0" |
| 35 | CELLSPACING="0" |
| 36 | ><TR |
| 37 | ><TH |
| 38 | COLSPAN="3" |
| 39 | ALIGN="center" |
| 40 | >Linux Trace Toolkit Viewer Developer Guide</TH |
| 41 | ></TR |
| 42 | ><TR |
| 43 | ><TD |
| 44 | WIDTH="10%" |
| 45 | ALIGN="left" |
| 46 | VALIGN="bottom" |
| 47 | ><A |
| 48 | HREF="x46.html" |
| 49 | ACCESSKEY="P" |
| 50 | >Prev</A |
| 51 | ></TD |
| 52 | ><TD |
| 53 | WIDTH="80%" |
| 54 | ALIGN="center" |
| 55 | VALIGN="bottom" |
| 56 | >Chapter 2. How to use the Linux Trace Toolkit Viewer's Reading Context</TD |
| 57 | ><TD |
| 58 | WIDTH="10%" |
| 59 | ALIGN="right" |
| 60 | VALIGN="bottom" |
| 61 | ><A |
| 62 | HREF="c67.html" |
| 63 | ACCESSKEY="N" |
| 64 | >Next</A |
| 65 | ></TD |
| 66 | ></TR |
| 67 | ></TABLE |
| 68 | ><HR |
| 69 | ALIGN="LEFT" |
| 70 | WIDTH="100%"></DIV |
| 71 | ><DIV |
| 72 | CLASS="sect1" |
| 73 | ><H1 |
| 74 | CLASS="sect1" |
| 75 | ><A |
| 76 | NAME="AEN50" |
| 77 | >2.3. Using the reading context</A |
| 78 | ></H1 |
| 79 | ><P |
| 80 | > If you have read the tutorials about writing a text and a graphic module, you |
| 81 | should be fairly ready to use the information provided to your hook by the |
| 82 | reading API. |
| 83 | </P |
| 84 | ><P |
| 85 | > The data structures of the reading context are based on the gobject, a |
| 86 | object-oriented library from the glib. Some evolved types that are found in the |
| 87 | context also comes from the "glib" (GArray, GHashTable and so on). For detailed |
| 88 | information about "gobjects" and the "glib", see the <A |
| 89 | HREF="http://www.gtk.org" |
| 90 | TARGET="_top" |
| 91 | >www.gtk.org</A |
| 92 | > website. They provide a complete |
| 93 | API reference about the data types they provide. |
| 94 | </P |
| 95 | ><P |
| 96 | > The reading context is object oriented. It is described by the lttv/tracecontext.h |
| 97 | header. Is can be illustrated with this UML class diagram : |
| 98 | </P |
| 99 | ><P |
| 100 | > <DIV |
| 101 | CLASS="mediaobject" |
| 102 | ><P |
| 103 | ><IMG |
| 104 | SRC="lttv-context.png" |
| 105 | ALIGN="center"><DIV |
| 106 | CLASS="caption" |
| 107 | ><P |
| 108 | >Linux Trace Toolkit Viewer Reading Context Class Diagram</P |
| 109 | ></DIV |
| 110 | ></P |
| 111 | ></DIV |
| 112 | > |
| 113 | </P |
| 114 | ><P |
| 115 | > Though, for performance's sake, navigating through it is not as encapsulated as |
| 116 | it could. Consider the class attributes to be all public (no get/set functions). |
| 117 | Sometimes, iteration upon a specific element can be uneasy. For example, you may |
| 118 | have to get the number of tracefiles in a trace from the "vt" field of the trace |
| 119 | context to be able to iterate over all the tracefiles contained by the trace. |
| 120 | </P |
| 121 | ><P |
| 122 | > To facilitate the common operations on the reading context, LTTV now provides a |
| 123 | header that consists of simple macros : lttv/contextmacros.h. It gives an object |
| 124 | look-and-feel to the context classes. Simple "GET" macros can be used to easily |
| 125 | access the different fields are iterate over the elements (and get the total |
| 126 | number of elements too). |
| 127 | </P |
| 128 | ></DIV |
| 129 | ><DIV |
| 130 | CLASS="NAVFOOTER" |
| 131 | ><HR |
| 132 | ALIGN="LEFT" |
| 133 | WIDTH="100%"><TABLE |
| 134 | SUMMARY="Footer navigation table" |
| 135 | WIDTH="100%" |
| 136 | BORDER="0" |
| 137 | CELLPADDING="0" |
| 138 | CELLSPACING="0" |
| 139 | ><TR |
| 140 | ><TD |
| 141 | WIDTH="33%" |
| 142 | ALIGN="left" |
| 143 | VALIGN="top" |
| 144 | ><A |
| 145 | HREF="x46.html" |
| 146 | ACCESSKEY="P" |
| 147 | >Prev</A |
| 148 | ></TD |
| 149 | ><TD |
| 150 | WIDTH="34%" |
| 151 | ALIGN="center" |
| 152 | VALIGN="top" |
| 153 | ><A |
| 154 | HREF="index.html" |
| 155 | ACCESSKEY="H" |
| 156 | >Home</A |
| 157 | ></TD |
| 158 | ><TD |
| 159 | WIDTH="33%" |
| 160 | ALIGN="right" |
| 161 | VALIGN="top" |
| 162 | ><A |
| 163 | HREF="c67.html" |
| 164 | ACCESSKEY="N" |
| 165 | >Next</A |
| 166 | ></TD |
| 167 | ></TR |
| 168 | ><TR |
| 169 | ><TD |
| 170 | WIDTH="33%" |
| 171 | ALIGN="left" |
| 172 | VALIGN="top" |
| 173 | >Why an event driven trace reader ?</TD |
| 174 | ><TD |
| 175 | WIDTH="34%" |
| 176 | ALIGN="center" |
| 177 | VALIGN="top" |
| 178 | ><A |
| 179 | HREF="c40.html" |
| 180 | ACCESSKEY="U" |
| 181 | >Up</A |
| 182 | ></TD |
| 183 | ><TD |
| 184 | WIDTH="33%" |
| 185 | ALIGN="right" |
| 186 | VALIGN="top" |
| 187 | >Linux Trace Toolkit Viewer Graphical Module Tutorial</TD |
| 188 | ></TR |
| 189 | ></TABLE |
| 190 | ></DIV |
| 191 | ></BODY |
| 192 | ></HTML |
| 193 | > |