[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] xen/trace: Implement TRACE_?D() in a more efficient fashon



commit af4acbc7a5f705417729e413f7678ae090688a1e
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Jul 18 16:24:42 2019 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Jul 19 10:53:14 2019 +0100

    xen/trace: Implement TRACE_?D() in a more efficient fashon
    
    These can easily be expressed with a variadic macro. No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
 xen/include/xen/trace.h | 99 +++++++++++++------------------------------------
 1 file changed, 26 insertions(+), 73 deletions(-)

diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h
index bd5168f568..af925bcfcc 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -81,80 +81,33 @@ static inline void __trace_hypercall(uint32_t event, 
unsigned long op,
     do {                                        \
         trace_var(_e, 1, 0, NULL);              \
     } while ( 0 )
-  
-#define TRACE_1D(_e,d1)                                         \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[1];                                          \
-            _d[0] = d1;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
- 
-#define TRACE_2D(_e,d1,d2)                                      \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[2];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
- 
-#define TRACE_3D(_e,d1,d2,d3)                                   \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[3];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            _d[2] = d3;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
- 
-#define TRACE_4D(_e,d1,d2,d3,d4)                                \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[4];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            _d[2] = d3;                                         \
-            _d[3] = d4;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
- 
-#define TRACE_5D(_e,d1,d2,d3,d4,d5)                             \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[5];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            _d[2] = d3;                                         \
-            _d[3] = d4;                                         \
-            _d[4] = d5;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
 
-#define TRACE_6D(_e,d1,d2,d3,d4,d5,d6)                             \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[6];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            _d[2] = d3;                                         \
-            _d[3] = d4;                                         \
-            _d[4] = d5;                                         \
-            _d[5] = d6;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
+/* Common helper for TRACE_{1..6}D() below. */
+#define TRACE_varD(_e, ...)                             \
+    do {                                                \
+        if ( unlikely(tb_init_done) )                   \
+        {                                               \
+            uint32_t _d[] = { __VA_ARGS__ };            \
+            __trace_var(_e, true, sizeof(_d), _d);      \
+        }                                               \
     } while ( 0 )
 
+#define TRACE_1D(_e, d1) \
+    TRACE_varD(_e, d1)
+
+#define TRACE_2D(_e, d1, d2) \
+    TRACE_varD(_e, d1, d2)
+
+#define TRACE_3D(_e, d1, d2, d3) \
+    TRACE_varD(_e, d1, d2, d3)
+
+#define TRACE_4D(_e, d1, d2, d3, d4) \
+    TRACE_varD(_e, d1, d2, d3, d4)
+
+#define TRACE_5D(_e, d1, d2, d3, d4, d5) \
+    TRACE_varD(_e, d1, d2, d3, d4, d5)
+
+#define TRACE_6D(_e, d1, d2, d3, d4, d5, d6) \
+    TRACE_varD(_e, d1, d2, d3, d4, d5, d6)
+
 #endif /* __XEN_TRACE_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.