|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2.1 13/12] xen/trace: Introduce new API
This will be used to clean up mess of macros which exists throughout the
codebase.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
CC: Ian Jackson <iwj@xxxxxxxxxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Julien Grall <julien@xxxxxxx>
v2.1:
* New
---
xen/include/xen/trace.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h
index 055883287e8c..72c20550f6a6 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -74,6 +74,30 @@ static inline void __trace_hypercall(uint32_t event,
unsigned long op,
const xen_ulong_t *args) {}
#endif /* CONFIG_TRACEBUFFER */
+/*
+ * Create a trace record, packaging up to 7 additional parameters into a
+ * uint32_t array.
+ */
+#define TRACE_INTERNAL(_e, _c, ...) \
+ do { \
+ if ( unlikely(tb_init_done) ) \
+ { \
+ uint32_t _d[] = { __VA_ARGS__ }; \
+ BUILD_BUG_ON(ARRAY_SIZE(_d) > TRACE_EXTRA_MAX); \
+ __trace_var(_e, _c, sizeof(_d), sizeof(_d) ? _d : NULL); \
+ } \
+ } while ( 0 )
+
+/* Split a uint64_t into two adjacent uint32_t's for a trace record. */
+#define TRACE_PARAM64(p) (uint32_t)(p), ((p) >> 32)
+
+/* Create a trace record with time included. */
+#define TRACE_TIME(_e, ...) TRACE_INTERNAL(_e, true, ##__VA_ARGS__)
+
+/* Create a trace record with no time included. */
+#define TRACE(_e, ...) TRACE_INTERNAL(_e, false, ##__VA_ARGS__)
+
+
/* Convenience macros for calling the trace function. */
#define TRACE_0D(_e) \
do { \
--
2.11.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |