[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 5/8] meson: generate trace events for qmp commands
From: |
Markus Armbruster |
Subject: |
[PULL v2 5/8] meson: generate trace events for qmp commands |
Date: |
Thu, 27 Jan 2022 15:21:59 +0100 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1. Use --gen-trace when generate qmp commands
2. Add corresponding .trace-events files as outputs in qapi_files
custom target
3. Define global qapi_trace_events list of .trace-events file targets,
to fill in trace/qapi.build and to use in trace/meson.build
4. In trace/meson.build use the new array as an additional source of
.trace_events files to be processed
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220126161130.3240892-5-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
meson.build | 3 +++
qapi/meson.build | 9 ++++++++-
trace/meson.build | 11 ++++++++---
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index 833fd6bc4c..e0cfafe8d9 100644
--- a/meson.build
+++ b/meson.build
@@ -41,6 +41,7 @@ qemu_icondir = get_option('datadir') / 'icons'
config_host_data = configuration_data()
genh = []
+qapi_trace_events = []
target_dirs = config_host['TARGET_DIRS'].split()
have_linux_user = false
@@ -2557,6 +2558,8 @@ if 'CONFIG_VHOST_USER' in config_host
vhost_user = libvhost_user.get_variable('vhost_user_dep')
endif
+# NOTE: the trace/ subdirectory needs the qapi_trace_events variable
+# that is filled in by qapi/.
subdir('qapi')
subdir('qobject')
subdir('stubs')
diff --git a/qapi/meson.build b/qapi/meson.build
index c0c49c15e4..b22558ca73 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -114,6 +114,7 @@ foreach module : qapi_all_modules
'qapi-events-@0@.h'.format(module),
'qapi-commands-@0@.c'.format(module),
'qapi-commands-@0@.h'.format(module),
+ 'qapi-commands-@0@.trace-events'.format(module),
]
endif
if module.endswith('-target')
@@ -126,7 +127,7 @@ endforeach
qapi_files = custom_target('shared QAPI source files',
output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs,
input: [ files('qapi-schema.json') ],
- command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
+ command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@', '--gen-trace' ],
depend_files: [ qapi_inputs, qapi_gen_depends ])
# Now go through all the outputs and add them to the right sourceset.
@@ -137,6 +138,9 @@ foreach output : qapi_util_outputs
if output.endswith('.h')
genh += qapi_files[i]
endif
+ if output.endswith('.trace-events')
+ qapi_trace_events += qapi_files[i]
+ endif
util_ss.add(qapi_files[i])
i = i + 1
endforeach
@@ -145,6 +149,9 @@ foreach output : qapi_specific_outputs +
qapi_nonmodule_outputs
if output.endswith('.h')
genh += qapi_files[i]
endif
+ if output.endswith('.trace-events')
+ qapi_trace_events += qapi_files[i]
+ endif
specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i])
i = i + 1
endforeach
diff --git a/trace/meson.build b/trace/meson.build
index 573dd699c6..c4794a1f2a 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -2,10 +2,15 @@
specific_ss.add(files('control-target.c'))
trace_events_files = []
-foreach dir : [ '.' ] + trace_events_subdirs
- trace_events_file = meson.project_source_root() / dir / 'trace-events'
+foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events
+ if item in qapi_trace_events
+ trace_events_file = item
+ group_name = item.full_path().split('/')[-1].underscorify()
+ else
+ trace_events_file = meson.project_source_root() / item / 'trace-events'
+ group_name = item == '.' ? 'root' : item.underscorify()
+ endif
trace_events_files += [ trace_events_file ]
- group_name = dir == '.' ? 'root' : dir.underscorify()
group = '--group=' + group_name
fmt = '@0@-' + group_name + '.@1@'
--
2.31.1
- [PULL v2 0/8] QAPI patches patches for 2022-01-27, Markus Armbruster, 2022/01/27
- [PULL v2 2/8] qapi/gen: Add FOO.trace-events output module, Markus Armbruster, 2022/01/27
- [PULL v2 7/8] meson: document why we don't generate trace events for tests/ and qga/, Markus Armbruster, 2022/01/27
- [PULL v2 4/8] qapi/commands: Optionally generate trace for QMP commands, Markus Armbruster, 2022/01/27
- [PULL v2 5/8] meson: generate trace events for qmp commands,
Markus Armbruster <=
- [PULL v2 8/8] qapi: generate trace events by default, Markus Armbruster, 2022/01/27
- [PULL v2 1/8] schemas: add missing vim modeline, Markus Armbruster, 2022/01/27
- [PULL v2 6/8] docs/qapi-code-gen: update to cover trace events code generation, Markus Armbruster, 2022/01/27
- [PULL v2 3/8] qapi/commands: refactor error handling code, Markus Armbruster, 2022/01/27
- Re: [PULL v2 0/8] QAPI patches patches for 2022-01-27, Peter Maydell, 2022/01/27