megasas: Implement DCMD_CLUSTER_RESET_LD
[qemu/ar7.git] / scripts / tracetool / backend / stderr.py
blob2a1e9064c30dc9124e9b58748d137bae12d39dbd
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 """
5 Stderr built-in backend.
6 """
8 __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
9 __copyright__ = "Copyright 2012-2014, 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
19 PUBLIC = True
22 def generate_h_begin(events):
23 out('#include <stdio.h>',
24 '#include "trace/control.h"',
25 '')
28 def generate_h(event):
29 argnames = ", ".join(event.args.names())
30 if len(event.args) > 0:
31 argnames = ", " + argnames
33 out(' if (trace_event_get_state(%(event_id)s)) {',
34 ' fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);',
35 ' }',
36 event_id="TRACE_" + event.name.upper(),
37 name=event.name,
38 fmt=event.fmt.rstrip("\n"),
39 argnames=argnames)