[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/2] trace: do not calculate arguments for disabled
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-devel] [PATCH 1/2] trace: do not calculate arguments for disabled trace-points |
Date: |
Fri, 21 Jul 2017 17:31:48 +0300 |
Do not calculate arguments if trace-point is disabled. For this:
- move to macro do { ... } while (0) scheme
- use additional macro-layer to handle calls of trace-points where
a macro generates parameter list
(like trace_e1000e_mac_set_permanent(MAC_ARG(macaddr)))
This is needed to allow some additional logic in trace-point parameter
calculation, which will not be executed if this trace-point is
disabled.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
scripts/tracetool/format/h.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index aecf249d66..d0baccc453 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -73,12 +73,13 @@ def generate(events, backend, group):
cond = "true"
out('',
- 'static inline void %(api)s(%(args)s)',
- '{',
- ' if (%(cond)s) {',
- ' %(api_nocheck)s(%(names)s);',
- ' }',
- '}',
+ '#define %(api)s(...) _do_%(api)s(__VA_ARGS__)',
+ '#define _do_%(api)s(%(names)s) \\',
+ 'do { \\',
+ ' if (%(cond)s) { \\',
+ ' %(api_nocheck)s(%(names)s); \\',
+ ' } \\',
+ '} while (0)',
api=e.api(),
api_nocheck=e.api(e.QEMU_TRACE_NOCHECK),
args=e.args,
--
2.11.1