diff mbox

[Tracing,1/4] Move simple trace prototypes to header file

Message ID 1279814326-9422-1-git-send-email-stefanha@linux.vnet.ibm.com
State New
Headers show

Commit Message

Stefan Hajnoczi July 22, 2010, 3:58 p.m. UTC
Simple trace prototypes should not be in the tracetool code generator.
It is easier to modify and debug the code if they are in a regular C
header file.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
This patch is against the tracing branch:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing

 simpletrace.h |   37 +++++++++++++++++++++++++++++++++++++
 tracetool     |   22 +---------------------
 2 files changed, 38 insertions(+), 21 deletions(-)
 create mode 100644 simpletrace.h
diff mbox

Patch

diff --git a/simpletrace.h b/simpletrace.h
new file mode 100644
index 0000000..bec8d62
--- /dev/null
+++ b/simpletrace.h
@@ -0,0 +1,37 @@ 
+/*
+ * Simple trace backend
+ *
+ * Copyright IBM, Corp. 2010
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef SIMPLETRACE_H
+#define SIMPLETRACE_H
+
+#include <stdbool.h>
+#include <stdio.h>
+
+typedef unsigned int TraceEventID;
+
+typedef struct {
+    const char *tp_name;
+    bool state;
+} TraceEvent;
+
+void trace0(TraceEventID event);
+void trace1(TraceEventID event, unsigned long x1);
+void trace2(TraceEventID event, unsigned long x1, unsigned long x2);
+void trace3(TraceEventID event, unsigned long x1, unsigned long x2, unsigned long x3);
+void trace4(TraceEventID event, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long x4);
+void trace5(TraceEventID event, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long x4, unsigned long x5);
+void st_print_trace(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...));
+void st_print_trace_events(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...));
+void st_print_trace_file_status(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...));
+void st_flush_trace_buffer(void);
+void st_set_trace_file_enabled(bool enable);
+void change_trace_event_state(const char *tname, bool tstate);
+
+#endif /* SIMPLETRACE_H */
diff --git a/tracetool b/tracetool
index ac832af..4890e66 100755
--- a/tracetool
+++ b/tracetool
@@ -138,27 +138,7 @@  linetoc_end_nop()
 linetoh_begin_simple()
 {
     cat <<EOF
-#include <stdbool.h>
-
-typedef unsigned int TraceEventID;
-
-typedef struct {
-    const char *tp_name;
-    bool state;
-} TraceEvent;
-
-void trace0(TraceEventID event);
-void trace1(TraceEventID event, unsigned long x1);
-void trace2(TraceEventID event, unsigned long x1, unsigned long x2);
-void trace3(TraceEventID event, unsigned long x1, unsigned long x2, unsigned long x3);
-void trace4(TraceEventID event, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long x4);
-void trace5(TraceEventID event, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long x4, unsigned long x5);
-void st_print_trace(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...));
-void st_print_trace_events(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...));
-void st_print_trace_file_status(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...));
-void st_flush_trace_buffer(void);
-void st_set_trace_file_enabled(bool enable);
-void change_trace_event_state(const char *tname, bool tstate);
+#include "simpletrace.h"
 EOF
 
     simple_event_num=0