+
+
+static inline uint64_t ltt_get_timestamp()
+{
+ return get_cycles();
+}
+
+static inline unsigned int ltt_subbuf_header_len(struct ltt_buf *buf)
+{
+ return sizeof(struct ltt_block_start_header);
+}
+
+
+
+static inline void ltt_write_trace_header(struct ltt_trace_header *header)
+{
+ header->magic_number = LTT_TRACER_MAGIC_NUMBER;
+ header->major_version = LTT_TRACER_VERSION_MAJOR;
+ header->minor_version = LTT_TRACER_VERSION_MINOR;
+ header->float_word_order = 0; //FIXME
+ header->arch_type = 0; //FIXME LTT_ARCH_TYPE;
+ header->arch_size = sizeof(void*);
+ header->arch_variant = 0; //FIXME LTT_ARCH_VARIANT;
+ header->flight_recorder = 0;
+ header->has_heartbeat = 0;
+
+#ifdef CONFIG_LTT_ALIGNMENT
+ header->has_alignment = sizeof(void*);
+#else
+ header->has_alignment = 0;
+#endif
+
+ //FIXME
+ header->freq_scale = 0;
+ header->start_freq = 0;
+ header->start_tsc = 0;
+ header->start_monotonic = 0;
+ header->start_time_sec = 0;
+ header->start_time_usec = 0;
+}
+
+
+static inline void ltt_buffer_begin_callback(struct ltt_buf *buf,
+ uint64_t tsc, unsigned int subbuf_idx)
+{
+ struct ltt_block_start_header *header =
+ (struct ltt_block_start_header*)
+ (buf->start + (subbuf_idx*buf->subbuf_size));
+
+ header->begin.cycle_count = tsc;
+ header->begin.freq = 0; //ltt_frequency();
+
+ header->lost_size = 0xFFFFFFFF; // for debugging...
+
+ header->buf_size = buf->subbuf_size;
+
+ ltt_write_trace_header(&header->trace);
+
+}
+
+
+
+static inline void ltt_buffer_end_callback(struct ltt_buf *buf,
+ uint64_t tsc, unsigned int offset, unsigned int subbuf_idx)
+{
+ struct ltt_block_start_header *header =
+ (struct ltt_block_start_header*)
+ (buf->start + (subbuf_idx*buf->subbuf_size));
+ /* offset is assumed to never be 0 here : never deliver a completely
+ * empty subbuffer. */
+ /* The lost size is between 0 and subbuf_size-1 */
+ header->lost_size = SUBBUF_OFFSET((buf->subbuf_size - offset),
+ buf);
+ header->end.cycle_count = tsc;
+ header->end.freq = 0; //ltt_frequency();
+}
+
+
+static inline void ltt_deliver_callback(struct ltt_buf *buf,
+ unsigned subbuf_idx,
+ void *subbuf)
+{
+ ltt_usertrace_fast_buffer_switch();
+}