| 1 | #ifndef EVENT_H |
| 2 | #define EVENT_H |
| 3 | |
| 4 | #include <ltt/ltt.h> |
| 5 | |
| 6 | /* Events and their content, including the raw data, are only valid |
| 7 | until reading another event from the same tracefile. |
| 8 | Indeed, since event reading is critical to the performance, |
| 9 | the memory associated with an event may be reused at each read. */ |
| 10 | |
| 11 | |
| 12 | /* Obtain the trace unique integer id associated with the type of |
| 13 | this event */ |
| 14 | |
| 15 | unsigned ltt_event_eventtype_id(LttEvent *e); |
| 16 | |
| 17 | |
| 18 | /* Facility and type for the event */ |
| 19 | |
| 20 | LttFacility *ltt_event_facility(LttEvent *e); |
| 21 | |
| 22 | LttEventType *ltt_event_eventtype(LttEvent *e); |
| 23 | |
| 24 | |
| 25 | /* Root field for the event */ |
| 26 | |
| 27 | LttField *ltt_event_field(LttEvent *e); |
| 28 | |
| 29 | |
| 30 | /* Time and cycle count for the event */ |
| 31 | |
| 32 | LttTime ltt_event_time(LttEvent *e); |
| 33 | |
| 34 | LttCycleCount ltt_event_cycle_count(LttEvent *e); |
| 35 | |
| 36 | |
| 37 | /* CPU id of the event */ |
| 38 | |
| 39 | unsigned ltt_event_cpu_id(LttEvent *e); |
| 40 | |
| 41 | |
| 42 | /* Pointer to the raw data for the event. This should not be used directly |
| 43 | unless prepared to do all the architecture specific conversions. */ |
| 44 | |
| 45 | void *ltt_event_data(LttEvent *e); |
| 46 | |
| 47 | |
| 48 | /* The number of elements in a sequence field is specific to each event |
| 49 | instance. This function returns the number of elements for an array or |
| 50 | sequence field in an event. */ |
| 51 | |
| 52 | unsigned ltt_event_field_element_number(LttEvent *e, LttField *f); |
| 53 | |
| 54 | |
| 55 | /* Set the currently selected element for a sequence or array field. */ |
| 56 | |
| 57 | void ltt_event_field_element_select(LttEvent *e, LttField *f, unsigned i); |
| 58 | |
| 59 | |
| 60 | /* A union is like a structure except that only a single member at a time |
| 61 | is present depending on the specific event instance. This function tells |
| 62 | the active member for a union field in an event. */ |
| 63 | |
| 64 | unsigned ltt_event_field_union_member(LttEvent *e, LttField *f); |
| 65 | |
| 66 | |
| 67 | /* These functions extract data from an event after architecture specific |
| 68 | conversions. */ |
| 69 | |
| 70 | unsigned ltt_event_get_unsigned(LttEvent *e, LttField *f); |
| 71 | |
| 72 | int ltt_event_get_int(LttEvent *e, LttField *f); |
| 73 | |
| 74 | unsigned long ltt_event_get_long_unsigned(LttEvent *e, LttField *f); |
| 75 | |
| 76 | long int ltt_event_get_long_int(LttEvent *e, LttField *f); |
| 77 | |
| 78 | float ltt_event_get_float(LttEvent *e, LttField *f); |
| 79 | |
| 80 | double ltt_event_get_double(LttEvent *e, LttField *f); |
| 81 | |
| 82 | |
| 83 | /* The string obtained is only valid until the next read from |
| 84 | the same tracefile. */ |
| 85 | |
| 86 | char *ltt_event_get_string(LttEvent *e, LttField *f); |
| 87 | |
| 88 | #endif // EVENT_H |