[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/9] tracetool: Add support for the 'stderr' backend
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 4/9] tracetool: Add support for the 'stderr' backend |
Date: |
Wed, 18 Apr 2012 15:07:19 +0100 |
From: Lluís Vilanova <address@hidden>
Signed-off-by: Lluís Vilanova <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
scripts/tracetool/backend/stderr.py | 56 +++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 scripts/tracetool/backend/stderr.py
diff --git a/scripts/tracetool/backend/stderr.py
b/scripts/tracetool/backend/stderr.py
new file mode 100644
index 0000000..917fde7
--- /dev/null
+++ b/scripts/tracetool/backend/stderr.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Stderr built-in backend.
+"""
+
+__author__ = "Lluís Vilanova <address@hidden>"
+__copyright__ = "Copyright 2012, Lluís Vilanova <address@hidden>"
+__license__ = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__ = "address@hidden"
+
+
+from tracetool import out
+
+
+def c(events):
+ out('#include "trace.h"',
+ '',
+ 'TraceEvent trace_list[] = {')
+
+ for e in events:
+ out('{.tp_name = "%(name)s", .state=0},',
+ name = e.name,
+ )
+
+ out('};')
+
+def h(events):
+ out('#include <stdio.h>',
+ '#include "trace/stderr.h"',
+ '',
+ 'extern TraceEvent trace_list[];')
+
+ for num, e in enumerate(events):
+ argnames = ", ".join(e.args.names())
+ if len(e.args) > 0:
+ argnames = ", " + argnames
+
+ out('static inline void trace_%(name)s(%(args)s)',
+ '{',
+ ' if (trace_list[%(event_num)s].state != 0) {',
+ ' fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);',
+ ' }',
+ '}',
+ name = e.name,
+ args = e.args,
+ event_num = num,
+ fmt = e.fmt,
+ argnames = argnames,
+ )
+
+ out('',
+ '#define NR_TRACE_EVENTS %d' % len(events))
--
1.7.9.5
- [Qemu-devel] [PULL 0/9] Tracing patches, Stefan Hajnoczi, 2012/04/18
- [Qemu-devel] [PATCH 5/9] tracetool: Add support for the 'simple' backend, Stefan Hajnoczi, 2012/04/18
- [Qemu-devel] [PATCH 6/9] tracetool: Add support for the 'ust' backend, Stefan Hajnoczi, 2012/04/18
- [Qemu-devel] [PATCH 9/9] tracetool: handle DTrace keywords 'in', 'next', 'self', Stefan Hajnoczi, 2012/04/18
- [Qemu-devel] [PATCH 7/9] tracetool: Add support for the 'dtrace' backend, Stefan Hajnoczi, 2012/04/18
- [Qemu-devel] [PATCH 2/9] tracetool: Add module for the 'c' format, Stefan Hajnoczi, 2012/04/18
- [Qemu-devel] [PATCH 8/9] tracetool: Add MAINTAINERS info, Stefan Hajnoczi, 2012/04/18
- [Qemu-devel] [PATCH 1/9] tracetool: Rewrite infrastructure as python modules, Stefan Hajnoczi, 2012/04/18
- [Qemu-devel] [PATCH 4/9] tracetool: Add support for the 'stderr' backend,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 3/9] tracetool: Add module for the 'h' format, Stefan Hajnoczi, 2012/04/18
- Re: [Qemu-devel] [PULL 0/9] Tracing patches, Andreas Färber, 2012/04/24