profiling: add DO_PROFILE_ADD_TIMED macro
authorChristian Ambach <ambi@samba.org>
Tue, 14 May 2013 16:57:12 +0000 (18:57 +0200)
committerChristian Ambach <ambi@samba.org>
Wed, 15 May 2013 08:05:07 +0000 (10:05 +0200)
can be used by code that determines the elapsed time on its own

Signed-off-by: Christian Ambach <ambi@samba.org>
source3/include/smbprofile.h

index 329a84feb26a28b6461ac12a774f3ea8cdd03bac..3060e41151c416414f52e43d7c3de381bee31bdc 100644 (file)
@@ -937,6 +937,12 @@ static inline uint64_t profile_timestamp(void)
                ADD_PROFILE_COUNT(x,n); \
        }
 
+#define DO_PROFILE_ADD_TIMED(x, t, n) \
+       DO_PROFILE_ADD(x##_count, n); \
+       if (do_profile_times) { \
+               ADD_PROFILE_COUNT(x##_time, t); \
+       }
+
 #define START_PROFILE_RAW(x, _stamp, _count) \
        _stamp = 0; \
        if (do_profile_flag) { \
@@ -977,6 +983,7 @@ static inline uint64_t profile_timestamp(void)
 #define DO_PROFILE_DEC(x)
 #define DO_PROFILE_DEC_INC(x,y)
 #define DO_PROFILE_ADD(x,n)
+#define DO_PROFILE_ADD_TIMED(x,t,n)
 #define START_PROFILE_STAMP(x, _stamp)
 #define START_PROFILE(x)
 #define START_PROFILE_BYTES(x,n)