state.c: convert LttvTraceHookByFacility to LttvTraceHook and fix other errors and...
[lttv.git] / ltt / branches / poly / ltt / event.h
CommitLineData
29af7cfd 1#ifndef _LTT_EVENT_H
2#define _LTT_EVENT_H
7c6b3cd7 3
29af7cfd 4#include <ltt/time.h>
3aee1200 5#include <glib.h>
29af7cfd 6#include <stdint.h>
eed2ef37 7#include <sys/types.h>
29af7cfd 8#include <ltt/ltt.h>
9#include <endian.h>
975e44c7 10
29af7cfd 11/*
12 * Structure LttEvent and LttEventPosition must begin with the _exact_ same
13 * fields in the exact same order. LttEventPosition is a parent of LttEvent.
14 */
15struct LttEvent {
16 /* Begin of LttEventPosition fields */
17 LttTracefile *tracefile;
18 unsigned int block;
19 unsigned int offset;
20
21 /* Timekeeping */
22 uint64_t tsc; /* Current timestamp counter */
23
24 /* End of LttEventPosition fields */
25 guint32 timestamp; /* truncated timestamp */
26
27 guint16 event_id;
28
29 LttTime event_time;
30
31 void *data; /* event data */
32 guint data_size;
33 guint event_size; /* event_size field of the header :
34 used to verify data_size from facility. */
35 uint32_t compact_data;
36
37 int count; /* the number of overflow of cycle count */
38 gint64 overflow_nsec; /* precalculated nsec for overflows */
39};
40
41struct LttEventPosition {
42 LttTracefile *tracefile;
43 unsigned int block;
44 unsigned int offset;
45
46 /* Timekeeping */
47 uint64_t tsc; /* Current timestamp counter */
48};
49
50static inline guint16 ltt_event_id(struct LttEvent *event)
51{
52 return event->event_id;
53}
54
55static inline LttTime ltt_event_time(struct LttEvent *event)
56{
57 return event->event_time;
58}
975e44c7 59
80da81ad 60/* Obtain the position of the event within the tracefile. This
61 is used to seek back to this position later or to seek to another
62 position, computed relative to this position. The event position
63 structure is opaque and contains several fields, only two
64 of which are user accessible: block number and event index
65 within the block. */
66
67void ltt_event_position(LttEvent *e, LttEventPosition *ep);
68
a5dcde2f 69LttEventPosition * ltt_event_position_new();
70
eed2ef37 71void ltt_event_position_get(LttEventPosition *ep, LttTracefile **tf,
72 guint *block, guint *offset, guint64 *tsc);
80da81ad 73
6d0cdf22 74void ltt_event_position_set(LttEventPosition *ep, LttTracefile *tf,
75 guint block, guint offset, guint64 tsc);
76
96da5c0d 77gint ltt_event_position_compare(const LttEventPosition *ep1,
78 const LttEventPosition *ep2);
80da81ad 79
2a74fbf4 80void ltt_event_position_copy(LttEventPosition *dest,
81 const LttEventPosition *src);
82
27304273 83LttTracefile *ltt_event_position_tracefile(LttEventPosition *ep);
84
29af7cfd 85#endif //_LTT_EVENT_H
This page took 0.050881 seconds and 4 git commands to generate.