19 * Structure LttEvent and LttEventPosition must begin with the _exact_ same
20 * fields in the exact same order. LttEventPosition is a parent of LttEvent.
23 /* Begin of LttEventPosition fields */
24 LttTracefile
*tracefile
;
29 uint64_t tsc
; /* Current timestamp counter */
31 /* End of LttEventPosition fields */
32 guint32 timestamp
; /* truncated timestamp */
38 void *data
; /* event data */
39 GArray
*fields_offsets
; /* current field offsets table */
41 guint event_size
; /* event_size field of the header :
42 used to verify data_size from marker. */
43 int count
; /* the number of overflow of cycle count */
44 gint64 overflow_nsec
; /* precalculated nsec for overflows */
47 struct LttEventPosition
{
48 LttTracefile
*tracefile
;
53 uint64_t tsc
; /* Current timestamp counter */
56 static inline guint16
ltt_event_id(const struct LttEvent
*event
)
58 return event
->event_id
;
61 static inline LttTime
ltt_event_time(const struct LttEvent
*event
)
63 return event
->event_time
;
66 /* Obtain the position of the event within the tracefile. This
67 is used to seek back to this position later or to seek to another
68 position, computed relative to this position. The event position
69 structure is opaque and contains several fields, only two
70 of which are user accessible: block number and event index
73 void ltt_event_position(const LttEvent
*e
, LttEventPosition
*ep
);
75 LttEventPosition
* ltt_event_position_new();
77 void ltt_event_position_get(LttEventPosition
*ep
, LttTracefile
**tf
,
78 guint
*block
, guint
*offset
, guint64
*tsc
);
80 void ltt_event_position_set(LttEventPosition
*ep
, LttTracefile
*tf
,
81 guint block
, guint offset
, guint64 tsc
);
83 gint
ltt_event_position_compare(const LttEventPosition
*ep1
,
84 const LttEventPosition
*ep2
);
86 void ltt_event_position_copy(LttEventPosition
*dest
,
87 const LttEventPosition
*src
);
89 LttTracefile
*ltt_event_position_tracefile(LttEventPosition
*ep
);
91 /* These functions extract data from an event after architecture specific
94 guint32
ltt_event_get_unsigned(LttEvent
*e
, struct marker_field
*f
);
96 gint32
ltt_event_get_int(LttEvent
*e
, struct marker_field
*f
);
98 guint64
ltt_event_get_long_unsigned(LttEvent
*e
, struct marker_field
*f
);
100 gint64
ltt_event_get_long_int(LttEvent
*e
, struct marker_field
*f
);
102 float ltt_event_get_float(LttEvent
*e
, struct marker_field
*f
);
104 double ltt_event_get_double(LttEvent
*e
, struct marker_field
*f
);
107 /* The string obtained is only valid until the next read from
108 * the same tracefile. */
110 gchar
*ltt_event_get_string(LttEvent
*e
, struct marker_field
*f
);
112 static inline LttCycleCount
ltt_event_cycle_count(const LttEvent
*e
)
117 static inline struct LttField
*ltt_event_field(const LttEvent
*e
, int index
)
119 return &g_array_index(e
->fields_offsets
, struct LttField
, index
);
122 #endif //_LTT_EVENT_H
This page took 0.039012 seconds and 4 git commands to generate.