update compat
[lttv.git] / trunk / lttv / ltt / event.h
CommitLineData
29af7cfd 1#ifndef _LTT_EVENT_H
2#define _LTT_EVENT_H
7c6b3cd7 3
3aee1200 4#include <glib.h>
29af7cfd 5#include <stdint.h>
eed2ef37 6#include <sys/types.h>
29af7cfd 7#include <endian.h>
f2a74ed3 8#include <ltt/ltt.h>
9#include <ltt/time.h>
f4e57537 10
11struct marker_field;
975e44c7 12
29af7cfd 13/*
14 * Structure LttEvent and LttEventPosition must begin with the _exact_ same
15 * fields in the exact same order. LttEventPosition is a parent of LttEvent.
16 */
17struct LttEvent {
18 /* Begin of LttEventPosition fields */
19 LttTracefile *tracefile;
20 unsigned int block;
21 unsigned int offset;
22
23 /* Timekeeping */
24 uint64_t tsc; /* Current timestamp counter */
25
26 /* End of LttEventPosition fields */
27 guint32 timestamp; /* truncated timestamp */
28
29 guint16 event_id;
30
31 LttTime event_time;
32
33 void *data; /* event data */
34 guint data_size;
35 guint event_size; /* event_size field of the header :
36 used to verify data_size from facility. */
37 uint32_t compact_data;
38
39 int count; /* the number of overflow of cycle count */
40 gint64 overflow_nsec; /* precalculated nsec for overflows */
41};
42
43struct LttEventPosition {
44 LttTracefile *tracefile;
45 unsigned int block;
46 unsigned int offset;
47
48 /* Timekeeping */
49 uint64_t tsc; /* Current timestamp counter */
50};
51
52static inline guint16 ltt_event_id(struct LttEvent *event)
53{
54 return event->event_id;
55}
56
57static inline LttTime ltt_event_time(struct LttEvent *event)
58{
59 return event->event_time;
60}
975e44c7 61
80da81ad 62/* Obtain the position of the event within the tracefile. This
63 is used to seek back to this position later or to seek to another
64 position, computed relative to this position. The event position
65 structure is opaque and contains several fields, only two
66 of which are user accessible: block number and event index
67 within the block. */
68
69void ltt_event_position(LttEvent *e, LttEventPosition *ep);
70
a5dcde2f 71LttEventPosition * ltt_event_position_new();
72
eed2ef37 73void ltt_event_position_get(LttEventPosition *ep, LttTracefile **tf,
74 guint *block, guint *offset, guint64 *tsc);
80da81ad 75
6d0cdf22 76void ltt_event_position_set(LttEventPosition *ep, LttTracefile *tf,
77 guint block, guint offset, guint64 tsc);
78
96da5c0d 79gint ltt_event_position_compare(const LttEventPosition *ep1,
80 const LttEventPosition *ep2);
80da81ad 81
2a74fbf4 82void ltt_event_position_copy(LttEventPosition *dest,
83 const LttEventPosition *src);
84
27304273 85LttTracefile *ltt_event_position_tracefile(LttEventPosition *ep);
86
c37440c8 87/* These functions extract data from an event after architecture specific
88 * conversions. */
89
90guint32 ltt_event_get_unsigned(LttEvent *e, struct marker_field *f);
91
92gint32 ltt_event_get_int(LttEvent *e, struct marker_field *f);
93
94guint64 ltt_event_get_long_unsigned(LttEvent *e, struct marker_field *f);
95
96gint64 ltt_event_get_long_int(LttEvent *e, struct marker_field *f);
97
98float ltt_event_get_float(LttEvent *e, struct marker_field *f);
99
100double ltt_event_get_double(LttEvent *e, struct marker_field *f);
101
102
103/* The string obtained is only valid until the next read from
104 * the same tracefile. */
105
106gchar *ltt_event_get_string(LttEvent *e, struct marker_field *f);
107
bb8c6629 108static inline LttCycleCount ltt_event_cycle_count(const LttEvent *e)
109{
110 return e->tsc;
111}
112
29af7cfd 113#endif //_LTT_EVENT_H
This page took 0.058217 seconds and 4 git commands to generate.