target-arm: Fix warn about implicit conversion
[qemu/cris-port.git] / scripts / tracetool / backend / log.py
blobb3ff0640118c5d0f812e81339f1a2049a4b156cb
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-2016, 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 "trace/control.h"',
24 '#include "qemu/log.h"',
25 '')
28 def generate_h(event):
29 argnames = ", ".join(event.args.names())
30 if len(event.args) > 0:
31 argnames = ", " + argnames
33 if "vcpu" in event.properties:
34 # already checked on the generic format code
35 cond = "true"
36 else:
37 cond = "trace_event_get_state(%s)" % ("TRACE_" + event.name.upper())
39 out(' if (%(cond)s) {',
40 ' struct timeval _now;',
41 ' gettimeofday(&_now, NULL);',
42 ' qemu_log_mask(LOG_TRACE, "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
43 ' getpid(),',
44 ' (size_t)_now.tv_sec, (size_t)_now.tv_usec',
45 ' %(argnames)s);',
46 ' }',
47 cond=cond,
48 name=event.name,
49 fmt=event.fmt.rstrip("\n"),
50 argnames=argnames)