X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt-tracer.h;h=d98d9d0c98214f5f87e22fb557f0dccf4122e147;hb=a0bea89bba00be4c2fc348b7c21fa7b0e4298a66;hp=1540a28acf06d8ed74f70503de35390864812b76;hpb=881833e349e275ac324fc3abf8a34d76f91047ea;p=lttng-modules.git diff --git a/ltt-tracer.h b/ltt-tracer.h index 1540a28a..d98d9d0c 100644 --- a/ltt-tracer.h +++ b/ltt-tracer.h @@ -1,14 +1,16 @@ +#ifndef _LTT_TRACER_H +#define _LTT_TRACER_H + /* - * Copyright (C) 2005,2006,2008 Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca) + * ltt-tracer.h + * + * Copyright (C) 2005-2011 Mathieu Desnoyers * * This contains the definitions for the Linux Trace Toolkit tracer. * * Dual LGPL v2.1/GPL v2 license. */ -#ifndef _LTT_TRACER_H -#define _LTT_TRACER_H - #include #include #include @@ -23,6 +25,14 @@ #include "ltt-tracer-core.h" #include "ltt-events.h" +#define LTTNG_VERSION 0 +#define LTTNG_PATCHLEVEL 9 +#define LTTNG_SUBLEVEL 1 + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + /* Number of bytes to log with a read/write event */ #define LTT_LOG_RW_SIZE 32L @@ -92,73 +102,25 @@ enum ltt_channels { * concerns. */ -#define LTT_RESERVED_EVENTS 3 -#define LTT_EVENT_BITS 5 -#define LTT_FREE_EVENTS ((1 << LTT_EVENT_BITS) - LTT_RESERVED_EVENTS) -#define LTT_TSC_BITS 27 -#define LTT_TSC_MASK ((1 << LTT_TSC_BITS) - 1) - -struct event_header { - u32 id_time; /* 5 bits event id (MSB); 27 bits time (LSB) */ -}; - -/* Reservation flags */ -#define LTT_RFLAG_ID (1 << 0) -#define LTT_RFLAG_ID_SIZE (1 << 1) -#define LTT_RFLAG_ID_SIZE_TSC (1 << 2) - #define LTT_MAX_SMALL_SIZE 0xFFFFU -/* - * We use asm/timex.h : cpu_khz/HZ variable in here : we might have to deal - * specifically with CPU frequency scaling someday, so using an interpolation - * between the start and end of buffer values is not flexible enough. Using an - * immediate frequency value permits to calculate directly the times for parts - * of a buffer that would be before a frequency change. - * - * Keep the natural field alignment for _each field_ within this structure if - * you ever add/remove a field from this header. Packed attribute is not used - * because gcc generates poor code on at least powerpc and mips. Don't ever - * let gcc add padding between the structure elements. - */ -struct packet_header { - uint32_t magic; /* - * Trace magic number. - * contains endianness information. - */ - uint8_t trace_uuid[16]; - uint32_t stream_id; - uint64_t timestamp_begin; /* Cycle count at subbuffer start */ - uint64_t timestamp_end; /* Cycle count at subbuffer end */ - uint32_t content_size; /* Size of data in subbuffer */ - uint32_t packet_size; /* Subbuffer size (include padding) */ - uint32_t events_lost; /* - * Events lost in this subbuffer since - * the beginning of the trace. - * (may overflow) - */ - /* TODO: move to metadata */ -#if 0 - uint8_t major_version; - uint8_t minor_version; - uint8_t arch_size; /* Architecture pointer size */ - uint8_t alignment; /* LTT data alignment */ - uint64_t start_time_sec; /* NTP-corrected start time */ - uint64_t start_time_usec; - uint64_t start_freq; /* - * Frequency at trace start, - * used all along the trace. - */ - uint32_t freq_scale; /* Frequency scaling (divisor) */ -#endif //0 - uint8_t header_end[0]; /* End of header */ -}; +#ifdef RING_BUFFER_ALIGN +#define ltt_alignof(type) __alignof__(type) +#else +#define ltt_alignof(type) 1 +#endif /* Tracer properties */ #define CTF_MAGIC_NUMBER 0xC1FC1FC1 #define TSDL_MAGIC_NUMBER 0x75D11D57 -#define LTT_TRACER_VERSION_MAJOR 3 -#define LTT_TRACER_VERSION_MINOR 0 +#define CTF_VERSION_MAJOR 0 +#define CTF_VERSION_MINOR 1 + +/* + * Number of milliseconds to retry before failing metadata writes on buffer full + * condition. (10 seconds) + */ +#define LTTNG_METADATA_TIMEOUT_MSEC 10000 /* * Size reserved for high priority events (interrupts, NMI, BH) at the end of a @@ -168,6 +130,9 @@ struct packet_header { */ #define LTT_RESERVE_CRITICAL 4096 +#define LTT_RFLAG_EXTENDED RING_BUFFER_RFLAG_END +#define LTT_RFLAG_END (LTT_RFLAG_EXTENDED << 1) + /* Register and unregister function pointers */ enum ltt_module_function {