s3/profiling: don't use CLOCK_PROCESS_CPUTIME_ID
authorBjörn Jacke <bj@sernet.de>
Tue, 14 Sep 2010 20:17:47 +0000 (22:17 +0200)
committerBjörn Jacke <bj@sernet.de>
Thu, 16 Sep 2010 19:47:08 +0000 (21:47 +0200)
that clock is a CPU burnometer but we need a chronometer for profiling.
(cherry picked from commit 5f6a145800a9e67c638f3ee05e43bb12fafffb48)

source3/include/proto.h
source3/lib/util.c
source3/profile/profile.c

index b6d15fb33e434df528067d82c313e1e60d1dcc96..596bd45164f981b071f085fda3fc999ce1856740 100644 (file)
@@ -1281,7 +1281,6 @@ char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
 char *procid_str_static(const struct server_id *pid);
 bool procid_valid(const struct server_id *pid);
 bool procid_is_local(const struct server_id *pid);
-int this_is_smp(void);
 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
index fd7cdca3cc1761d3bfb4c94608c58f10558ab4a9..efa2ca2043a5257414c12317271f560c74c47852 100644 (file)
@@ -2737,23 +2737,6 @@ bool procid_is_local(const struct server_id *pid)
 #endif
 }
 
-int this_is_smp(void)
-{
-#if defined(HAVE_SYSCONF)
-
-#if defined(SYSCONF_SC_NPROC_ONLN)
-        return (sysconf(_SC_NPROC_ONLN) > 1) ? 1 : 0;
-#elif defined(SYSCONF_SC_NPROCESSORS_ONLN)
-        return (sysconf(_SC_NPROCESSORS_ONLN) > 1) ? 1 : 0;
-#else
-       return 0;
-#endif
-
-#else
-       return 0;
-#endif
-}
-
 /****************************************************************
  Check if offset/length fit into bufsize. Should probably be
  merged with is_offset_safe, but this would require a rewrite
index 4a61753ea388e553011d19af8128bc97ac36d792..3e0df15f6523d79e3eaf626439e7ff875173ba88 100644 (file)
@@ -145,24 +145,6 @@ static void init_clock_gettime(void)
 
        have_profiling_clock = False;
 
-#ifdef HAVE_CLOCK_PROCESS_CPUTIME_ID
-       /* CLOCK_PROCESS_CPUTIME_ID is sufficiently fast that the
-        * always profiling times is plausible. Unfortunately on Linux
-        * it is only accurate if we can guarantee we will not be scheduled
-        * scheduled onto a different CPU between samples. Until there is
-        * some way to set processor affinity, we can only use this on
-        * uniprocessors.
-        */
-       if (!this_is_smp()) {
-           if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) == 0) {
-                   DEBUG(10, ("Using CLOCK_PROCESS_CPUTIME_ID "
-                               "for profile_clock\n"));
-                   __profile_clock = CLOCK_PROCESS_CPUTIME_ID;
-                   have_profiling_clock = True;
-           }
-       }
-#endif
-
 #ifdef HAVE_CLOCK_MONOTONIC
        if (!have_profiling_clock &&
            clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {