block/nvme: Correctly initialize Admin Queue Attributes
[qemu/ar7.git] / scripts / tracetool / backend / ftrace.py
blobe9844dd335c56fdb3c92102d8e8ad2bcd02dbe6a
1 # -*- coding: utf-8 -*-
3 """
4 Ftrace built-in backend.
5 """
7 __author__ = "Eiichi Tsukata <eiichi.tsukata.xh@hitachi.com>"
8 __copyright__ = "Copyright (C) 2013 Hitachi, Ltd."
9 __license__ = "GPL version 2 or (at your option) any later version"
11 __maintainer__ = "Stefan Hajnoczi"
12 __email__ = "stefanha@redhat.com"
15 from tracetool import out
18 PUBLIC = True
21 def generate_h_begin(events, group):
22 out('#include "trace/ftrace.h"',
23 '')
26 def generate_h(event, group):
27 argnames = ", ".join(event.args.names())
28 if len(event.args) > 0:
29 argnames = ", " + argnames
31 out(' {',
32 ' char ftrace_buf[MAX_TRACE_STRLEN];',
33 ' int unused __attribute__ ((unused));',
34 ' int trlen;',
35 ' if (trace_event_get_state(%(event_id)s)) {',
36 ' trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
37 ' "%(name)s " %(fmt)s "\\n" %(argnames)s);',
38 ' trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
39 ' unused = write(trace_marker_fd, ftrace_buf, trlen);',
40 ' }',
41 ' }',
42 name=event.name,
43 args=event.args,
44 event_id="TRACE_" + event.name.upper(),
45 fmt=event.fmt.rstrip("\n"),
46 argnames=argnames)
49 def generate_h_backend_dstate(event, group):
50 out(' trace_event_get_state_dynamic_by_id(%(event_id)s) || \\',
51 event_id="TRACE_" + event.name.upper())