update compat
[lttv.git] / tags / lttv-0.10.0-pre15-12082008 / doc / developer / lttv_process_traceset_strict_boundaries.txt
CommitLineData
5750899b 1Linux Trace Toolkit
2
3Mathieu Desnoyers 17-05-2004
4
5
61. Read Requests Cases Study
7
8The goal of this document is to describe the typical behavior of viewers when
9they request data to a process traceset. After the implementation of three
10viewers, with different needs, the idea of their need for a trace processing API
11is getting clearer. We then describe a new API for process traceset that would
12better suits the needs of those viewers.
13
14They are splitted in two different categories : the first one is the one where
15the viewers select the events they need by specifying a time interval in the
16traceset and the second one is where the viewers specify a start event by its
17position in the traceset and a certain amount of events it needs.
18
19This is a simplified case study : we look at the direct interaction between
20graphical viewers and process traceset, without the main window as a negociator.
21
22Control Flow Viewer
23
24This viewer, consisting in a two dimensions graph, shows the different processes
25as its y axis and the time as x axis. It's clear that it needs to get the events
26by specifying a start time and an end time, constituing a time interval.
27
28
29Detailed Events List
30
31This list has nothing to do with time : it shows the events one by one. It cares
32about the quantity of events, not their time.
33
34It would be simple to get the events one by one if we were reading only one
35tracefile (one cpu), but the way events are read through each trace
36(monothically increasing time) makes it a little bit more difficult to specify
37how to increment event position. We will determine how it could be done simply.
38
39Let's define an event position. It's a pointer to a position into each
40tracefile. It's only meaningful when associated with a context. Comparisons
41between positions are done by looking comparing saved positions for each
42tracefile, until a difference is found.
43
44A viewer could use a start time as a start event. It would specify a number of
45events it needs. As a first call, it could ask for the start time of the
46traceset. Afterward, it can save the position of the context after the last
47event has been delivered in its after traceset function.
48
49Now, let's see how process traceset could handle it. It would seek in the
50traceset, searching the position number.
51(need a new lttv_process_traceset_seek_position)
52
53Then, the viewer could simply call a process traceset middle function
54specifying a number of events to get.
55
56The whole concept of numbering events would be hidden in the order in which the
57process traceset gets the events in a monothically increasing time.
58
59
60
612. Architecture
62
63API to seek/read traceset will be extended to fully support both start time,
64start position, end time, end position and number of events as possible
65boundaries for reading.
66
67lttv_process_traceset_seek_time
68lttv_process_traceset_seek_position
69
70lttv_process_traceset_middle
71
72It must be modified to end when it encounters the first criterion : number of
73events to read reached, end time reached, end position reached.
74
75lttv_traceset_context_position_save
76
77The position_save saves a position that can be used later to seek back to this
78exact same position, with event granularity. This implies that the
79process_traceset must deliver events with the same timestamp in a deterministic
80manner. This is actually done by using tracefile and trace numbers in the
81context in the comparison function.
82
83
84
85Description of new context API useage
86
871. seek
882. begin -> add middle hooks
89 -> call begin hooks by id
903. middle -> call middle hooks by id
914. end -> call end hooks by id
92 -> remove middle hooks
93
943. Impact on State
95
96From now on, the state computation will be done in the middle hook call, with a
97priority higher than default. We will define this priority as PRIO_STATE,
98defined to 25.
99
100If state has to be computed, lttv_process_traceset_begin has to be called in
101a first time. It adds the state hooks to the context. Then, the state
102seek_closest will have to be used to restore the nearest state, plus a
103process_traceset with no hooks present other than the state hooks will have to
104be called to go from the closest state to the real time seeked.
105
106The lttv_process_traceset_end will only need to be called if no further state
107computation is needed.
108
109
1104. Implementation in tracecontext.c
111
112
113- Type LttvTracesetContextPosition
114
115struct _LttvTraceContextPosition {
116 LttEventPosition *tf_pos; /* Position in each trace */
117 guint nb_tracefile; /* Number of tracefiles (check) */
118}
119
120struct _LttvTracesetContextPosition {
121 LttTraceContextPosition *t_pos; /* Position in each trace */
122 guint nb_trace; /* Number of traces (check) */
123}
124
125with interfaces :
126
127lttv_traceset_context_position_save
128(const LttvTracesetContext *context,
129 LttvTracesetContextPosition *pos);
130
131
132Dependencies :
133
134- lttv_process_traceset_seek_position(LttvTracesetContext *self,
135 const LttvTracesetContextPosition *position);
136 - ltt_tracefile_seek_position : already implemented
137
138lttv_process_traceset_seek_position will seek each tracefile to the right
139position. We keep information about number of tracefiles for extra integrity
140checking when reloading the position in the context. It also loads the pqueue.
141
142
143
144- lttv_process_traceset_middle
145We modify lttv_process_traceset_middle so that it takes as arguments :
146(LttvTracesetContext *self,
147LttTime end,
148unsigned nb_events,
149const LttvTracesetContextPosition *end_position)
150
151This new version of process traceset middle will call the event hooks for
152events until the first criterion is fulfilled : either the end time is reached,
153the number of events requested is passed, the end position is reached or the
154last event hook list called returned TRUE. When this function ends, the end
155position can be extracted from the context, the end event is set as described
156below and the number of events read is returned.
157
158The end event is a pointer to the last event the hooks has been called for.
159
160- lttv_process_traceset_seek_time : already implemented
161 - now loads the pqueue.
162
163- lttv_process_traceset_begin(LttvTracesetContext *self,
164 LttvHooks *before_traceset,
165 LttvHooks *before_trace,
166 LttvHooks *before_tracefile,
167 LttvHooks *event,
168 LttvHooksById *event_by_id)
169
170
171- lttv_process_traceset_end(LttvTracesetContext *self,
172 LttvHooks *after_traceset,
173 LttvHooks *after_trace,
174 LttvHooks *after_tracefile,
175 LttvHooks *event,
176 LttvHooksById *event_by_id)
177
178- lttv_traceset_context_add_hooks and lttv_traceset_context_remove_hooks
179
180These functions now become internal to tracecontext.c
181
182
183
184
This page took 0.029434 seconds and 4 git commands to generate.