LTTV is now alive : needs testing
[lttv.git] / ltt / branches / poly / ltt / event.h
CommitLineData
9c312311 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
7c6b3cd7 19#ifndef EVENT_H
20#define EVENT_H
21
3aee1200 22#include <glib.h>
7c6b3cd7 23#include <ltt/ltt.h>
eed2ef37 24#include <sys/types.h>
975e44c7 25
c02ea99f 26LttEvent *ltt_event_new();
27
28void ltt_event_destroy(LttEvent *event);
29
975e44c7 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
1b82f325 35/* Obtain the trace unique integer id associated with the type of
975e44c7 36 this event */
37
eed2ef37 38unsigned ltt_event_eventtype_id(const LttEvent *e);
975e44c7 39
eed2ef37 40unsigned ltt_event_facility_id(const LttEvent *e);
975e44c7 41
42/* Facility and type for the event */
43
eed2ef37 44LttFacility *ltt_event_facility(const LttEvent *e);
975e44c7 45
eed2ef37 46LttEventType *ltt_event_eventtype(const LttEvent *e);
975e44c7 47
1b82f325 48
49/* Root field for the event */
50
290dfc8c 51LttField *ltt_event_field(LttEvent *e);
975e44c7 52
1b82f325 53
975e44c7 54/* Time and cycle count for the event */
55
eed2ef37 56LttTime ltt_event_time(const LttEvent *e);
975e44c7 57
eed2ef37 58LttCycleCount ltt_event_cycle_count(const LttEvent *e);
975e44c7 59
60
80da81ad 61/* Obtain the position of the event within the tracefile. This
62 is used to seek back to this position later or to seek to another
63 position, computed relative to this position. The event position
64 structure is opaque and contains several fields, only two
65 of which are user accessible: block number and event index
66 within the block. */
67
68void ltt_event_position(LttEvent *e, LttEventPosition *ep);
69
a5dcde2f 70LttEventPosition * ltt_event_position_new();
71
eed2ef37 72void ltt_event_position_get(LttEventPosition *ep, LttTracefile **tf,
73 guint *block, guint *offset, guint64 *tsc);
80da81ad 74
96da5c0d 75gint ltt_event_position_compare(const LttEventPosition *ep1,
76 const LttEventPosition *ep2);
80da81ad 77
2a74fbf4 78void ltt_event_position_copy(LttEventPosition *dest,
79 const LttEventPosition *src);
80
290dfc8c 81/* CPU id of the event */
975e44c7 82
290dfc8c 83unsigned ltt_event_cpu_id(LttEvent *e);
975e44c7 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
290dfc8c 89void *ltt_event_data(LttEvent *e);
975e44c7 90
91
a6bf5e74 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. */
975e44c7 95
3aee1200 96guint64 ltt_event_field_element_number(LttEvent *e, LttField *f);
975e44c7 97
98
99/* Set the currently selected element for a sequence or array field. */
100
290dfc8c 101void ltt_event_field_element_select(LttEvent *e, LttField *f, unsigned i);
975e44c7 102
103
a6bf5e74 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
108unsigned ltt_event_field_union_member(LttEvent *e, LttField *f);
109
110
975e44c7 111/* These functions extract data from an event after architecture specific
112 conversions. */
113
63c35f6c 114guint32 ltt_event_get_unsigned(LttEvent *e, LttField *f);
975e44c7 115
63c35f6c 116gint32 ltt_event_get_int(LttEvent *e, LttField *f);
975e44c7 117
63c35f6c 118guint64 ltt_event_get_long_unsigned(LttEvent *e, LttField *f);
975e44c7 119
63c35f6c 120gint64 ltt_event_get_long_int(LttEvent *e, LttField *f);
975e44c7 121
290dfc8c 122float ltt_event_get_float(LttEvent *e, LttField *f);
975e44c7 123
290dfc8c 124double ltt_event_get_double(LttEvent *e, LttField *f);
975e44c7 125
126
127/* The string obtained is only valid until the next read from
128 the same tracefile. */
129
45e14832 130gchar *ltt_event_get_string(LttEvent *e, LttField *f);
7c6b3cd7 131
eed2ef37 132size_t get_field_type_size(LttTracefile *tf,
133 LttEventType *event_type,
134 off_t offset_root, off_t offset_parent,
135 LttField *field, void *data);
136
137
138
7c6b3cd7 139#endif // EVENT_H
This page took 0.038953 seconds and 4 git commands to generate.