X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fltt%2Fltt-private.h;h=1bbe0a10ddcf9e56f0367e4785a77c0aceb19b13;hb=986e2a7c3f885178f7cf6385af8b325fee83d5f7;hp=c71c8fbc2665ac3d3f9606e68b5a7f3b49cd830a;hpb=d3d34f492bdbd2326ff345d8d1f84998df19f459;p=lttv.git diff --git a/ltt/branches/poly/ltt/ltt-private.h b/ltt/branches/poly/ltt/ltt-private.h index c71c8fbc..1bbe0a10 100644 --- a/ltt/branches/poly/ltt/ltt-private.h +++ b/ltt/branches/poly/ltt/ltt-private.h @@ -22,6 +22,7 @@ #include #include #include +#include #ifndef max @@ -38,6 +39,13 @@ /* Hardcoded facilities */ #define LTT_FACILITY_CORE 0 + +/* Byte ordering */ +#define LTT_GET_BO(t) ((t)->reverse_bo) + +#define LTT_HAS_FLOAT(t) ((t)->float_word_order!=0) +#define LTT_GET_FLOAT_BO(t) \ + (((t)->float_word_order==__BYTE_ORDER)?0:1) /* Hardcoded core events */ enum ltt_core_events { @@ -128,33 +136,73 @@ struct ltt_event_header_nohb { uint16_t event_size; } LTT_PACKED_STRUCT; -struct ltt_trace_header { + +/* Block and trace headers */ + +struct ltt_trace_header_any { uint32_t magic_number; uint32_t arch_type; uint32_t arch_variant; + uint32_t float_word_order; uint8_t arch_size; - //uint32_t system_type; - uint8_t major_version; - uint8_t minor_version; - uint8_t flight_recorder; - uint8_t has_heartbeat; - uint8_t has_alignment; /* Event header alignment */ - uint8_t has_tsc; + uint8_t major_version; + uint8_t minor_version; + uint8_t flight_recorder; + uint8_t has_heartbeat; + uint8_t has_alignment; /* Event header alignment */ + uint8_t has_tsc; +} LTT_PACKED_STRUCT; + + +/* For version 0.3 */ + +struct ltt_trace_header_0_3 { + uint32_t magic_number; + uint32_t arch_type; + uint32_t arch_variant; + uint32_t float_word_order; + uint8_t arch_size; + uint8_t major_version; + uint8_t minor_version; + uint8_t flight_recorder; + uint8_t has_heartbeat; + uint8_t has_alignment; /* Event header alignment */ + uint8_t has_tsc; +} LTT_PACKED_STRUCT; + +/* For version 0.4 */ + +struct ltt_trace_header_0_4 { + uint32_t magic_number; + uint32_t arch_type; + uint32_t arch_variant; + uint32_t float_word_order; + uint8_t arch_size; + uint8_t major_version; + uint8_t minor_version; + uint8_t flight_recorder; + uint8_t has_heartbeat; + uint8_t has_alignment; /* Event header alignment */ + uint8_t has_tsc; + uint64_t start_monotonic; + struct timespec start_time; } LTT_PACKED_STRUCT; struct ltt_block_start_header { struct { - struct timeval timestamp; + uint64_t timestamp; uint64_t cycle_count; + uint64_t freq; } begin; struct { - struct timeval timestamp; + uint64_t timestamp; uint64_t cycle_count; + uint64_t freq; } end; uint32_t lost_size; /* Size unused at the end of the buffer */ uint32_t buf_size; /* The size of this sub-buffer */ - struct ltt_trace_header trace; + struct ltt_trace_header_any trace[0]; } LTT_PACKED_STRUCT; @@ -294,16 +342,19 @@ typedef struct _LttBuffer { struct { LttTime timestamp; uint64_t cycle_count; + uint64_t freq; /* Frequency in khz */ } begin; struct { LttTime timestamp; uint64_t cycle_count; + uint64_t freq; /* Frequency in khz */ } end; uint32_t lost_size; /* Size unused at the end of the buffer */ /* Timekeeping */ uint64_t tsc; /* Current timestamp counter */ - double nsecs_per_cycle; + uint64_t freq; /* Frequency in khz */ + double nsecs_per_cycle; /* Precalculated from freq */ } LttBuffer; struct _LttTracefile{ @@ -314,9 +365,12 @@ struct _LttTracefile{ LttTrace * trace; //trace containing the tracefile int fd; //file descriptor off_t file_size; //file size - unsigned block_size; //block_size + //unsigned block_size; //block_size unsigned int num_blocks; //number of blocks in the file gboolean reverse_bo; //must we reverse byte order ? + gboolean float_word_order; //what is the byte order of floats ? + + size_t buffer_header_size; /* Current event */ LttEvent event; //Event currently accessible in the trace @@ -345,7 +399,8 @@ struct _LttTrace{ GArray *facilities_by_num; /* fac_id as index in array */ GData *facilities_by_name; /* fac name (GQuark) as index */ /* Points to array of fac_id of all the - * facilities that has this name. */ + * facilities that has this name. */ + guint num_cpu; guint32 arch_type; guint32 arch_variant; @@ -356,6 +411,8 @@ struct _LttTrace{ guint8 has_heartbeat; guint8 has_alignment; guint8 has_tsc; + uint64_t start_monotonic; + LttTime start_time; GData *tracefiles; //tracefiles groups }; @@ -390,7 +447,5 @@ struct _LttSystemDescription { //#define EVENT_ID_SIZE sizeof(guint16) //#define EVENT_HEADER_SIZE (TIMESTAMP_SIZE + EVENT_ID_SIZE) -#define LTT_GET_BO(t) ((t)->reverse_bo) - #endif /* LTT_PRIVATE_H */