Rework about dialog by using gtk_show_about_dialog
[lttv.git] / ltt / event.h
CommitLineData
a9048165 1#ifndef _LTT_EVENT_H
29af7cfd 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
1184dc37
MD
13struct LttField {
14 int offset;
15 int size;
16};
17
29af7cfd 18/*
19 * Structure LttEvent and LttEventPosition must begin with the _exact_ same
20 * fields in the exact same order. LttEventPosition is a parent of LttEvent.
21 */
22struct LttEvent {
23 /* Begin of LttEventPosition fields */
24 LttTracefile *tracefile;
25 unsigned int block;
26 unsigned int offset;
27
28 /* Timekeeping */
29 uint64_t tsc; /* Current timestamp counter */
30
31 /* End of LttEventPosition fields */
32 guint32 timestamp; /* truncated timestamp */
33
34 guint16 event_id;
35
36 LttTime event_time;
37
38 void *data; /* event data */
1184dc37 39 GArray *fields_offsets; /* current field offsets table */
29af7cfd 40 guint data_size;
41 guint event_size; /* event_size field of the header :
2fc874ab 42 used to verify data_size from marker. */
29af7cfd 43 int count; /* the number of overflow of cycle count */
44 gint64 overflow_nsec; /* precalculated nsec for overflows */
45};
46
47struct LttEventPosition {
48 LttTracefile *tracefile;
49 unsigned int block;
50 unsigned int offset;
51
52 /* Timekeeping */
53 uint64_t tsc; /* Current timestamp counter */
54};
55
43ed82b5 56static inline guint16 ltt_event_id(const struct LttEvent *event)
29af7cfd 57{
58 return event->event_id;
59}
60
750eb11a 61static inline LttTime ltt_event_time(const struct LttEvent *event)
29af7cfd 62{
63 return event->event_time;
64}
975e44c7 65
80da81ad 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
71 within the block. */
72
8b0a0cc8 73void ltt_event_position(const LttEvent *e, LttEventPosition *ep);
80da81ad 74
a5dcde2f 75LttEventPosition * ltt_event_position_new();
76
eed2ef37 77void ltt_event_position_get(LttEventPosition *ep, LttTracefile **tf,
78 guint *block, guint *offset, guint64 *tsc);
80da81ad 79
6d0cdf22 80void ltt_event_position_set(LttEventPosition *ep, LttTracefile *tf,
81 guint block, guint offset, guint64 tsc);
82
96da5c0d 83gint ltt_event_position_compare(const LttEventPosition *ep1,
84 const LttEventPosition *ep2);
80da81ad 85
2a74fbf4 86void ltt_event_position_copy(LttEventPosition *dest,
87 const LttEventPosition *src);
88
27304273 89LttTracefile *ltt_event_position_tracefile(LttEventPosition *ep);
90
c37440c8 91/* These functions extract data from an event after architecture specific
92 * conversions. */
93
94guint32 ltt_event_get_unsigned(LttEvent *e, struct marker_field *f);
95
96gint32 ltt_event_get_int(LttEvent *e, struct marker_field *f);
97
98guint64 ltt_event_get_long_unsigned(LttEvent *e, struct marker_field *f);
99
100gint64 ltt_event_get_long_int(LttEvent *e, struct marker_field *f);
101
102float ltt_event_get_float(LttEvent *e, struct marker_field *f);
103
104double ltt_event_get_double(LttEvent *e, struct marker_field *f);
105
106
107/* The string obtained is only valid until the next read from
108 * the same tracefile. */
109
110gchar *ltt_event_get_string(LttEvent *e, struct marker_field *f);
111
bb8c6629 112static inline LttCycleCount ltt_event_cycle_count(const LttEvent *e)
113{
114 return e->tsc;
115}
116
1184dc37
MD
117static inline struct LttField *ltt_event_field(const LttEvent *e, int index)
118{
119 return &g_array_index(e->fields_offsets, struct LttField, index);
120}
121
29af7cfd 122#endif //_LTT_EVENT_H
This page took 0.071797 seconds and 4 git commands to generate.