2 # -*- coding: utf-8 -*-
5 Stderr built-in backend.
8 __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
9 __copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
10 __license__ = "GPL version 2 or (at your option) any later version"
12 __maintainer__ = "Stefan Hajnoczi"
13 __email__ = "stefanha@linux.vnet.ibm.com"
16 from tracetool import out
20 out('#include "trace.h"',
22 'TraceEvent trace_list[] = {')
25 out('{.tp_name = "%(name)s", .state=0},',
32 out('#include <stdio.h>',
33 '#include "trace/stderr.h"',
35 'extern TraceEvent trace_list[];')
37 for num, e in enumerate(events):
38 argnames = ", ".join(e.args.names())
40 argnames = ", " + argnames
42 out('static inline void trace_%(name)s(%(args)s)',
44 ' if (trace_list[%(event_num)s].state != 0) {',
45 ' fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);',
56 '#define NR_TRACE_EVENTS %d' % len(events))