summaryrefslogtreecommitdiff
path: root/source3/include/smbprofile.h
diff options
context:
space:
mode:
Diffstat (limited to 'source3/include/smbprofile.h')
-rw-r--r--source3/include/smbprofile.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index dd171ac13e..fb5fa078c1 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -419,6 +419,25 @@ extern BOOL do_profile_times;
#define DEC_PROFILE_COUNT(x) profile_p->x--
#define ADD_PROFILE_COUNT(x,y) profile_p->x += (y)
+#if defined(HAVE_CLOCK_GETTIME)
+
+extern clockid_t __profile_clock;
+
+static inline unsigned long long profile_timestamp(void)
+{
+ struct timespec ts;
+
+ /* FIXME: On a single-CPU system, or a system where we have bound
+ * daemon threads to single CPUs (eg. using cpusets or processor
+ * affinity), it might be preferable to use CLOCK_PROCESS_CPUTIME_ID.
+ */
+
+ clock_gettime(__profile_clock, &ts);
+ return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); /* usec */
+}
+
+#else
+
static inline unsigned long long profile_timestamp(void)
{
struct timeval tv;
@@ -426,6 +445,8 @@ static inline unsigned long long profile_timestamp(void)
return (tv.tv_sec * 1000000) + tv.tv_usec;
}
+#endif
+
/* end of helper macros */
#define DO_PROFILE_INC(x) \