removed many g_error and exit(1) from the tracefile reader
[lttv.git] / ltt / branches / poly / ltt / event.h
1 /* This file is part of the Linux Trace Toolkit trace reading library
2 * Copyright (C) 2003-2004 Michel Dagenais
3 *
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.
7 *
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.
12 *
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.
17 */
18
19 #ifndef EVENT_H
20 #define EVENT_H
21
22 #include <ltt/ltt.h>
23
24 /* Events and their content, including the raw data, are only valid
25 until reading another event from the same tracefile.
26 Indeed, since event reading is critical to the performance,
27 the memory associated with an event may be reused at each read. */
28
29
30 /* Obtain the trace unique integer id associated with the type of
31 this event */
32
33 unsigned ltt_event_eventtype_id(LttEvent *e);
34
35
36 /* Facility and type for the event */
37
38 LttFacility *ltt_event_facility(LttEvent *e);
39
40 LttEventType *ltt_event_eventtype(LttEvent *e);
41
42
43 /* Root field for the event */
44
45 LttField *ltt_event_field(LttEvent *e);
46
47
48 /* Time and cycle count for the event */
49
50 LttTime ltt_event_time(LttEvent *e);
51
52 LttCycleCount ltt_event_cycle_count(LttEvent *e);
53
54
55 /* Obtain the position of the event within the tracefile. This
56 is used to seek back to this position later or to seek to another
57 position, computed relative to this position. The event position
58 structure is opaque and contains several fields, only two
59 of which are user accessible: block number and event index
60 within the block. */
61
62 void ltt_event_position(LttEvent *e, LttEventPosition *ep);
63
64 LttEventPosition * ltt_event_position_new();
65
66 void ltt_event_position_get(LttEventPosition *ep,
67 unsigned *block_number, unsigned *index_in_block, LttTracefile ** tf);
68
69 void ltt_event_position_set(LttEventPosition *ep,
70 unsigned block_number, unsigned index_in_block);
71
72 gint ltt_event_position_compare(const LttEventPosition *ep1,
73 const LttEventPosition *ep2);
74
75 gint ltt_event_event_position_compare(const LttEvent *event,
76 const LttEventPosition *ep);
77
78 void ltt_event_position_copy(LttEventPosition *dest,
79 const LttEventPosition *src);
80
81 /* CPU id of the event */
82
83 unsigned ltt_event_cpu_id(LttEvent *e);
84
85
86 /* Pointer to the raw data for the event. This should not be used directly
87 unless prepared to do all the architecture specific conversions. */
88
89 void *ltt_event_data(LttEvent *e);
90
91
92 /* The number of elements in a sequence field is specific to each event
93 instance. This function returns the number of elements for an array or
94 sequence field in an event. */
95
96 unsigned ltt_event_field_element_number(LttEvent *e, LttField *f);
97
98
99 /* Set the currently selected element for a sequence or array field. */
100
101 void ltt_event_field_element_select(LttEvent *e, LttField *f, unsigned i);
102
103
104 /* A union is like a structure except that only a single member at a time
105 is present depending on the specific event instance. This function tells
106 the active member for a union field in an event. */
107
108 unsigned ltt_event_field_union_member(LttEvent *e, LttField *f);
109
110
111 /* These functions extract data from an event after architecture specific
112 conversions. */
113
114 unsigned ltt_event_get_unsigned(LttEvent *e, LttField *f);
115
116 int ltt_event_get_int(LttEvent *e, LttField *f);
117
118 unsigned long ltt_event_get_long_unsigned(LttEvent *e, LttField *f);
119
120 long int ltt_event_get_long_int(LttEvent *e, LttField *f);
121
122 float ltt_event_get_float(LttEvent *e, LttField *f);
123
124 double ltt_event_get_double(LttEvent *e, LttField *f);
125
126
127 /* The string obtained is only valid until the next read from
128 the same tracefile. */
129
130 char *ltt_event_get_string(LttEvent *e, LttField *f);
131
132 #endif // EVENT_H
This page took 0.031989 seconds and 4 git commands to generate.