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