]> git.proxmox.com Git - mirror_qemu.git/blame - trace/meson.build
meson: generate trace events for qmp commands
[mirror_qemu.git] / trace / meson.build
CommitLineData
aadac5b3 1
0e1309d0
MAL
2specific_ss.add(files('control-target.c'))
3
a81df1b6 4trace_events_files = []
b83a80e8
VSO
5foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events
6 if item in qapi_trace_events
7 trace_events_file = item
8 group_name = item.full_path().split('/')[-1].underscorify()
9 else
10 trace_events_file = meson.project_source_root() / item / 'trace-events'
11 group_name = item == '.' ? 'root' : item.underscorify()
12 endif
a81df1b6 13 trace_events_files += [ trace_events_file ]
a81df1b6
PB
14 group = '--group=' + group_name
15 fmt = '@0@-' + group_name + '.@1@'
16
17 trace_h = custom_target(fmt.format('trace', 'h'),
18 output: fmt.format('trace', 'h'),
19 input: trace_events_file,
0572d6cd
SH
20 command: [ tracetool, group, '--format=h', '@INPUT@', '@OUTPUT@' ],
21 depend_files: tracetool_depends)
a81df1b6
PB
22 genh += trace_h
23 trace_c = custom_target(fmt.format('trace', 'c'),
24 output: fmt.format('trace', 'c'),
25 input: trace_events_file,
0572d6cd
SH
26 command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ],
27 depend_files: tracetool_depends)
9c29b741 28 if 'ust' in get_option('trace_backends')
a81df1b6
PB
29 trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
30 output: fmt.format('trace-ust', 'h'),
31 input: trace_events_file,
0572d6cd
SH
32 command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
33 depend_files: tracetool_depends)
bbe47ed2 34 trace_ss.add(trace_ust_h, lttng)
a81df1b6
PB
35 genh += trace_ust_h
36 endif
37 trace_ss.add(trace_h, trace_c)
9c29b741 38 if 'dtrace' in get_option('trace_backends')
a81df1b6
PB
39 trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
40 output: fmt.format('trace-dtrace', 'dtrace'),
41 input: trace_events_file,
0572d6cd
SH
42 command: [ tracetool, group, '--format=d', '@INPUT@', '@OUTPUT@' ],
43 depend_files: tracetool_depends)
a81df1b6
PB
44 trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
45 output: fmt.format('trace-dtrace', 'h'),
46 input: trace_dtrace,
d051d0e1 47 command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
568ac779
RB
48 trace_ss.add(trace_dtrace_h)
49 if host_machine.system() != 'darwin'
50 trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
51 output: fmt.format('trace-dtrace', 'o'),
52 input: trace_dtrace,
d051d0e1 53 command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
568ac779
RB
54 trace_ss.add(trace_dtrace_o)
55 endif
a81df1b6 56
a81df1b6
PB
57 genh += trace_dtrace_h
58 endif
59endforeach
60
10e1d263
MAL
61trace_events_all = custom_target('trace-events-all',
62 output: 'trace-events-all',
63 input: trace_events_files,
64 command: [ 'cat', '@INPUT@' ],
65 capture: true,
66 install: true,
ab4c0996 67 install_dir: qemu_datadir)
a81df1b6 68
71c782f5
MAL
69foreach d : [
70 ['generated-tcg-tracers.h', 'tcg-h'],
71 ['generated-helpers.c', 'tcg-helper-c'],
72 ['generated-helpers.h', 'tcg-helper-h'],
73 ['generated-helpers-wrappers.h', 'tcg-helper-wrapper-h'],
74]
0e1309d0 75 gen = custom_target(d[0],
71c782f5 76 output: d[0],
654d6b04 77 input: meson.project_source_root() / 'trace-events',
0572d6cd
SH
78 command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@', '@OUTPUT@' ],
79 depend_files: tracetool_depends)
e921f1a7 80 specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
71c782f5
MAL
81endforeach
82
9c29b741 83if 'ust' in get_option('trace_backends')
a81df1b6
PB
84 trace_ust_all_h = custom_target('trace-ust-all.h',
85 output: 'trace-ust-all.h',
86 input: trace_events_files,
0572d6cd
SH
87 command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
88 depend_files: tracetool_depends)
a81df1b6
PB
89 trace_ust_all_c = custom_target('trace-ust-all.c',
90 output: 'trace-ust-all.c',
91 input: trace_events_files,
0572d6cd
SH
92 command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@', '@OUTPUT@' ],
93 depend_files: tracetool_depends)
a81df1b6
PB
94 trace_ss.add(trace_ust_all_h, trace_ust_all_c)
95 genh += trace_ust_all_h
96endif
97
9c29b741
PB
98if 'simple' in get_option('trace_backends')
99 trace_ss.add(files('simple.c'))
100endif
101if 'ftrace' in get_option('trace_backends')
102 trace_ss.add(files('ftrace.c'))
103endif
a81df1b6
PB
104trace_ss.add(files('control.c'))
105trace_ss.add(files('qmp.c'))