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