summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-06-20 08:44:30 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-20 12:58:58 +0200
commit0d1f3c13630610447e629c9fbe86c6545b063cff (patch)
tree681e6c12f8056f57cbe6b922293b36e46c0a9aba
parentb70164bc31854990a97c8010526a1a07e72a11d7 (diff)
downloadsamba-0d1f3c13630610447e629c9fbe86c6545b063cff.tar.gz
samba-0d1f3c13630610447e629c9fbe86c6545b063cff.tar.bz2
samba-0d1f3c13630610447e629c9fbe86c6545b063cff.zip
s3:include: add START/END_PROFILE_STAMP()
This is needed when the profiling spans multiple functions. metze
-rw-r--r--source3/include/smbprofile.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 4f5b6002fc..6e136a08fc 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -935,12 +935,19 @@ static inline uint64_t profile_timestamp(void)
ADD_PROFILE_COUNT(x,n); \
}
+#define START_PROFILE_RAW(x, _stamp, _count) \
+ _stamp = 0; \
+ if (do_profile_flag) { \
+ _stamp = do_profile_times ? profile_timestamp() : 0;\
+ INC_PROFILE_COUNT(_count); \
+ }
+
+#define START_PROFILE_STAMP(x, _stamp) \
+ START_PROFILE_RAW(x, _stamp, x##_count)
+
#define START_PROFILE(x) \
uint64_t __profstamp_##x = 0; \
- if (do_profile_flag) { \
- __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\
- INC_PROFILE_COUNT(x##_count); \
- }
+ START_PROFILE_RAW(x, __profstamp_##x, x##_count)
#define START_PROFILE_BYTES(x,n) \
uint64_t __profstamp_##x = 0; \
@@ -950,19 +957,28 @@ static inline uint64_t profile_timestamp(void)
ADD_PROFILE_COUNT(x##_bytes, n); \
}
-#define END_PROFILE(x) \
+#define END_PROFILE_RAW(x, _stamp, _time) \
if (do_profile_times) { \
- ADD_PROFILE_COUNT(x##_time, \
- profile_timestamp() - __profstamp_##x); \
+ ADD_PROFILE_COUNT(_time, \
+ profile_timestamp() - _stamp); \
}
+
+#define END_PROFILE_STAMP(x, _stamp) \
+ END_PROFILE_RAW(x, _stamp, x##_time)
+
+#define END_PROFILE(x) \
+ END_PROFILE_RAW(x, __profstamp_##x, x##_time)
+
#else /* WITH_PROFILE */
#define DO_PROFILE_INC(x)
#define DO_PROFILE_DEC(x)
#define DO_PROFILE_DEC_INC(x,y)
#define DO_PROFILE_ADD(x,n)
+#define START_PROFILE_STAMP(x, _stamp)
#define START_PROFILE(x)
#define START_PROFILE_BYTES(x,n)
+#define END_PROFILE_STAMP(x, _stamp)
#define END_PROFILE(x)
#endif /* WITH_PROFILE */