84a8e7d0bb18a19ba04adcd4572d952b88d1887a
1 /* This file is part of the Linux Trace Toolkit trace reading library
2 * Copyright (C) 2004 Mathieu Desnoyers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License Version 2.1 as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 02111-1307, USA.
19 /* This is a header that contains macro helpers to give an object-oriented
20 * access to the Trace context, state and statistics.
24 #include <ltt/trace.h>
25 #include <lttv/tracecontext.h>
26 #include <lttv/state.h>
27 #include <lttv/stats.h>
29 /************ TracesetContext get methods ***************/
31 /* LTTV_TRACESET_CONTEXT_GET_TRACE_CONTEXT
33 * Input : LttvTracesetContext *tsc
34 * int trace number (0 .. num_traces -1)
35 * returns : (LttvTraceContext *)
37 #define LTTV_TRACESET_CONTEXT_GET_TRACE_CONTEXT(tsc, trace_num)\
38 (tsc->traces[trace_num])
40 /* LTTV_TRACESET_CONTEXT_GET_NUM_TRACES
42 * Input : LttvTracesetContext *tsc
43 * returns : (guint) the number of traces
45 #define LTTV_TRACESET_CONTEXT_GET_NUM_TRACES(tsc)\
46 (lttv_traceset_number(tsc->ts))
48 /* LTTV_TRACESET_CONTEXT_GET_TRACESET_STATS
50 * Input : LttvTracesetContext *tsc
51 * returns : (LttvTracesetStats*)
53 #define LTTV_TRACESET_CONTEXT_GET_TRACESET_STATS(tsc)\
54 ((LttvTracesetStats*)tsc)
57 /************ TraceContext get methods ***************/
59 /* LTTV_TRACE_CONTEXT_GET_TRACESET_CONTEXT
61 * Input : LttvTraceContext *tc
62 * returns : (LttvTracesetContext *)
64 #define LTTV_TRACE_CONTEXT_GET_TRACESET_CONTEXT(tc)\
68 /* LTTV_TRACE_CONTEXT_GET_TRACE_STATE
70 * Input : LttvTraceContext *tc
71 * returns : (LttvTraceState *)
73 #define LTTV_TRACE_CONTEXT_GET_TRACE_STATE(tc)\
76 /* LTTV_TRACE_CONTEXT_GET_TRACE_STATS
78 * Input : LttvTraceContext *tc
79 * returns : (LttvTraceStats *)
81 #define LTTV_TRACE_CONTEXT_GET_TRACE_STATS(tc)\
84 /* LTTV_TRACE_CONTEXT_GET_CPU_TRACEFILE_CONTEXT
86 * Input : LttvTraceContext *tc
87 * guint cpu_index (0 .. number_cpu-1)
88 * returns : (LttvTracefileContext*)
90 #define LTTV_TRACE_CONTEXT_GET_CPU_TRACEFILE_CONTEXT(tc, cpu_index)\
91 ( tc->tracefiles[cpu_index + ltt_trace_control_tracefile_number(tc->t)] )
93 /* LTTV_TRACE_CONTEXT_GET_NUMBER_CPU
95 * input : LttvTraceContext *tc
96 * returns : (guint) number_cpu
98 #define LTTV_TRACE_CONTEXT_GET_NUMBER_CPU(tc)\
99 ( ltt_trace_per_cpu_tracefile_number(tc->t) )
102 /* LTTV_TRACE_CONTEXT_GET_CONTROL_TRACEFILE_CONTEXT
104 * Input : LttvTraceContext *tc
105 * guint control_index (0 .. number_control-1)
106 * returns : (LttvTracefileContext*)
108 #define LTTV_TRACE_CONTEXT_GET_CONTROL_TRACEFILE_CONTEXT(tc, control_index)\
109 (tc->tracefiles[control_index])
111 /* LTTV_TRACE_CONTEXT_GET_NUMBER_CONTROL
113 * Input : LttvTraceContext *tc
114 * returns : (guint) number_control
116 #define LTTV_TRACE_CONTEXT_GET_NUMBER_CONTROL(tc)\
117 ( ltt_trace_control_tracefile_number(tc->t) )
119 /* LTTV_TRACE_CONTEXT_GET_TRACE
121 * Input : LttvTraceContext *tc
122 * returns : (LttvTrace*)
124 * NOTE : see traceset.h for LttvTrace methods
126 #define LTTV_TRACE_CONTEXT_GET_TRACE(tc)\
133 /************ TracefileContext get methods ***************/
135 /* LTTV_TRACEFILE_CONTEXT_GET_TRACE_CONTEXT
137 * Input : LttvTracefileContext *tfc
138 * returns : (LttvTraceContext*)
140 #define LTTV_TRACEFILE_CONTEXT_GET_TRACE_CONTEXT(tfc)\
143 /* LTTV_TRACEFILE_CONTEXT_GET_EVENT
145 * Input : LttvTracefileContext *tfc
146 * returns : (LttEvent *)
148 #define LTTV_TRACEFILE_CONTEXT_GET_EVENT(tfc)\
151 /* LTTV_TRACEFILE_CONTEXT_GET_TRACEFILE_STATE
153 * Input : LttvTracefileContext *tfc
154 * returns : (LttvTracefileState *)
156 #define LTTV_TRACEFILE_CONTEXT_GET_TRACEFILE_STATE(tfc)\
157 ((LttvTracefileState*)tfc)
159 /* LTTV_TRACEFILE_CONTEXT_GET_TRACEFILE_STATS
161 * Input : LttvTracefileContext *tfc
162 * returns : (LttvTracefileStats *)
164 #define LTTV_TRACEFILE_CONTEXT_GET_TRACEFILE_STATS(tfc)\
165 ((LttvTracefileStats*)tfc)
167 /* LTTV_TRACEFILE_CONTEXT_GET_TRACEFILE_INDEX
169 * Returns the tracefile index.
171 * It checks if it's a control tracefile or a cpu tracefile and returns the
172 * cpu_index or control_index, depending of the case.
174 * Input : LttvTracefileContext *tfc
175 * returns : (guint) cpu_index or control_index.
177 #define LTTV_TRACEFILE_CONTEXT_GET_TRACEFILE_INDEX(tfc)\
180 tfc->index-ltt_trace_control_tracefile_number(tfc->t_context->t))
184 /************ TraceState get methods ***************/
186 /* LTTV_TRACE_STATE_GET_TRACE_CONTEXT
188 * Input : LttvTraceState *tse
189 * returns : (LttvTraceContext*)
192 #define LTTV_TRACE_STATE_GET_TRACE_CONTEXT(tse)\
193 ((LttvTraceContext*)tse)
195 /* LTTV_TRACE_STATE_GET_EVENTTYPE_NAME
197 * Input : LttvTraceState *tse
198 * guint eventtype_number
201 * NOTE : use g_quark_to_string to convert a GQuark into a static char *
203 #define LTTV_TRACE_STATE_GET_EVENTTYPE_NAME(tse, eventtype_number)\
204 (tse->eventtype_names[eventtype_number])
206 /* LTTV_TRACE_STATE_GET_SYSCALL_NAME
208 * Input : LttvTraceState *tse
209 * guint syscall_number
212 * NOTE : use g_quark_to_string to convert a GQuark into a static char *
214 #define LTTV_TRACE_STATE_GET_EVENTTYPE_NAME(tse, syscall_number)\
215 (tse->syscall_names[syscall_number])
217 /* LTTV_TRACE_STATE_GET_TRAP_NAME
219 * Input : LttvTraceState *tse
223 * NOTE : use g_quark_to_string to convert a GQuark into a static char *
225 #define LTTV_TRACE_STATE_GET_TRAP_NAME(tse, trap_number)\
226 (tse->trap_names[trap_number])
228 /* LTTV_TRACE_STATE_GET_IRQ_NAME
230 * Input : LttvTraceState *tse
234 * NOTE : use g_quark_to_string to convert a GQuark into a static char *
236 #define LTTV_TRACE_STATE_GET_TRAP_NAME(tse, irq_number)\
237 (tse->irq_names[irq_number])
240 /* LTTV_TRACE_STATE_GET_PROCESS_STATE
242 * Input : LttvTraceState *tse
244 * guint cpu_index (0 .. number_cpu-1)
245 * returns : (LttvProcessState *)
247 * NOTE : if pid is 0, the special process corresponding to the CPU that
248 * corresponds to the tracefile will be returned.
249 * if pid is different than 0, the process returned may be running
250 * on any cpu of the trace.
252 #define LTTV_TRACE_STATE_GET_PROCESS_STATE(tse, pid, cpu_index)\
253 (lttv_state_find_process( \
254 (LttvTraceFileState*)tse->parent->tracefiles[\
256 ltt_trace_control_tracefile_number((LttvTraceContext*)tse->t)], pid))
259 /* LTTV_TRACE_STATE_GET_NUMBER_CPU
261 * input : LttvTraceState *tse
262 * returns : (guint) number_cpu
264 #define LTTV_TRACE_STATE_GET_NUMBER_CPU(tse)\
265 ( ltt_trace_per_cpu_tracefile_number((LttvTraceState*)tse->t) )
270 /************ TracefileState get methods ***************/
272 /* LTTV_TRACEFILE_STATE_GET_TRACEFILE_CONTEXT
274 * Input : LttvTracefileState *tfse
275 * returns : (LttvTracefileContext*)
278 #define LTTV_TRACEFILE_STATE_GET_TRACEFILE_CONTEXT(tfse)\
279 ((LttvTracefileContext*)tfse)
282 /* LTTV_TRACEFILE_STATE_GET_CURRENT_PROCESS_STATE
284 * Returns the state of the current process.
286 * Input : LttvTracefileState *tfse
287 * returns : (LttvProcessState *)
289 #define LTTV_TRACEFILE_STATE_GET_CURRENT_PROCESS_STATE(tfse)\
292 /* LTTV_TRACEFILE_STATE_GET_CPU_NAME
294 * Input : LttvTracefileState *tfse
297 * NOTE : use g_quark_to_string to convert a GQuark into a static char *
299 #define LTTV_TRACEFILE_STATE_GET_CPU_NAME(tfse)\
303 /* LTTV_TRACEFILE_STATE_GET_PROCESS_STATE
305 * Input : LttvTracefileState *tfse
307 * returns : (LttvProcessState *)
309 * NOTE : if pid is 0, the special process corresponding to the CPU that
310 * corresponds to the tracefile will be returned.
311 * if pid is different than 0, the process returned may be running
312 * on any cpu of the trace.
314 #define LTTV_TRACEFILE_STATE_GET_PROCESS_STATE(tfse, pid)\
315 (lttv_state_find_process(tfse, pid))
321 /************ ProcessState get methods ***************/
322 /* Use direct access to LttvProcessState members for other attributes */
323 /* see struct _LttvProcessState definition in state.h */
325 /* LTTV_PROCESS_STATE_GET_CURRENT_EXECUTION_STATE
327 * Input : LttvProcessState *pse
328 * returns : (LttvExecutionState*)
330 #define LTTV_PROCESS_STATE_GET_EXECUTION_STATE(pse)\
333 /* LTTV_PROCESS_STATE_GET_NESTED_EXECUTION_STATE
335 * Input : LttvProcessState *pse
336 * guint nest_number (0 to num_nest-1)
337 * returns : (LttvExecutionState*)
339 #define LTTV_PROCESS_STATE_GET_NESTED_EXECUTION_STATE(pse, num_nest)\
340 ((LttvExecutionState*)pse->execution_stack[num_nest])
343 /* LTTV_PROCESS_STATE_GET_NUM_NESTED_EXECUTION_STATES
345 * Returns the number of nested execution states currently on the stack.
347 * Input : LttvProcessState *pse
350 #define LTTV_PROCESS_STATE_GET_NUM_NESTED_EXECUTION_STATES(pse)\
351 (pse->execution_stack->len)
354 /************ ExecutionState get methods ***************/
355 /* Use direct access to LttvExecutionState members to access attributes */
356 /* see struct _LttvExecutionState definition in state.h */
This page took 0.036496 seconds and 3 git commands to generate.