blob: 8d893bd849175b9eae8d213d783d893bd9e7bb9c [file] [log] [blame]
Stefan Hajnoczi26f72272010-05-22 19:24:51 +01001/*
2 * Simple trace backend
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2. See
7 * the COPYING file in the top-level directory.
8 *
9 */
10
11#ifndef SIMPLETRACE_H
12#define SIMPLETRACE_H
13
14#include <stdint.h>
Prerna Saxena22890ab2010-06-24 17:04:53 +053015#include <stdbool.h>
16#include <stdio.h>
Stefan Hajnoczi26f72272010-05-22 19:24:51 +010017
Stefan Hajnoczi0b5538c2011-02-26 18:38:39 +000018#ifdef CONFIG_SIMPLE_TRACE
Stefan Hajnoczi26f72272010-05-22 19:24:51 +010019typedef uint64_t TraceEventID;
20
Prerna Saxena22890ab2010-06-24 17:04:53 +053021typedef struct {
22 const char *tp_name;
23 bool state;
24} TraceEvent;
25
Stefan Hajnoczi26f72272010-05-22 19:24:51 +010026void trace0(TraceEventID event);
27void trace1(TraceEventID event, uint64_t x1);
28void trace2(TraceEventID event, uint64_t x1, uint64_t x2);
29void trace3(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3);
30void trace4(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4);
31void trace5(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5);
32void trace6(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5, uint64_t x6);
Stefan Weil0b2c5082010-11-15 21:17:06 +010033void st_print_trace(FILE *stream, fprintf_function stream_printf);
34void st_print_trace_events(FILE *stream, fprintf_function stream_printf);
Blue Swirlf871d682010-10-13 19:14:29 +000035bool st_change_trace_event_state(const char *tname, bool tstate);
Stefan Weil0b2c5082010-11-15 21:17:06 +010036void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf);
Stefan Hajnoczic5ceb522010-07-13 09:26:33 +010037void st_set_trace_file_enabled(bool enable);
38bool st_set_trace_file(const char *file);
39void st_flush_trace_buffer(void);
Stefan Hajnoczi31d3c9b2011-03-13 20:14:30 +000040bool st_init(const char *file);
Stefan Hajnoczi0b5538c2011-02-26 18:38:39 +000041#else
Stefan Hajnoczi31d3c9b2011-03-13 20:14:30 +000042static inline bool st_init(const char *file)
Stefan Hajnoczi0b5538c2011-02-26 18:38:39 +000043{
Stefan Hajnoczi31d3c9b2011-03-13 20:14:30 +000044 return true;
Stefan Hajnoczi0b5538c2011-02-26 18:38:39 +000045}
46#endif /* !CONFIG_SIMPLE_TRACE */
Stefan Hajnoczi26f72272010-05-22 19:24:51 +010047
48#endif /* SIMPLETRACE_H */