Author: jpeach
Date: 2006-06-09 10:50:45 +0000 (Fri, 09 Jun 2006)
New Revision: 16116

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16116

Log:
Hoist the slow CLOCK_REALTIME message inside the branch so we never
confuse an uninitialised __profile_clock with CLOCK_REALTIME. Flip the
condition argument to SMB_WARN around so that it's correct (though
completely non-intuitive).

Modified:
   branches/SAMBA_3_0/source/profile/profile.c
   trunk/source/profile/profile.c


Changeset:
Modified: branches/SAMBA_3_0/source/profile/profile.c
===================================================================
--- branches/SAMBA_3_0/source/profile/profile.c 2006-06-09 10:50:28 UTC (rev 
16115)
+++ branches/SAMBA_3_0/source/profile/profile.c 2006-06-09 10:50:45 UTC (rev 
16116)
@@ -150,7 +150,6 @@
                DEBUG(10, ("Using CLOCK_MONOTONIC for profile_clock\n"));
                __profile_clock = CLOCK_MONOTONIC;
                have_profiling_clock = True;
-               return;
        }
 #endif
 
@@ -162,15 +161,16 @@
            clock_gettime(CLOCK_REALTIME, &ts) == 0) {
                __profile_clock = CLOCK_REALTIME;
                have_profiling_clock = True;
+
+               SMB_WARN(__profile_clock != CLOCK_REALTIME,
+                       ("forced to use a slow profiling clock"));
        }
 
-       SMB_WARN(__profile_clock == CLOCK_REALTIME,
-               ("Using (slow) CLOCK_REALTIME for profile_clock"));
 #endif
 
-       SMB_WARN(have_profiling_clock == False,
+       SMB_WARN(have_profiling_clock == True,
                ("could not find a working clock for profiling"));
-       return have_profiling_clock;
+       return;
 }
 #endif
 

Modified: trunk/source/profile/profile.c
===================================================================
--- trunk/source/profile/profile.c      2006-06-09 10:50:28 UTC (rev 16115)
+++ trunk/source/profile/profile.c      2006-06-09 10:50:45 UTC (rev 16116)
@@ -150,7 +150,6 @@
                DEBUG(10, ("Using CLOCK_MONOTONIC for profile_clock\n"));
                __profile_clock = CLOCK_MONOTONIC;
                have_profiling_clock = True;
-               return;
        }
 #endif
 
@@ -162,15 +161,16 @@
            clock_gettime(CLOCK_REALTIME, &ts) == 0) {
                __profile_clock = CLOCK_REALTIME;
                have_profiling_clock = True;
+
+               SMB_WARN(__profile_clock != CLOCK_REALTIME,
+                       ("forced to use a slow profiling clock"));
        }
 
-       SMB_WARN(__profile_clock == CLOCK_REALTIME,
-               ("Using (slow) CLOCK_REALTIME for profile_clock"));
 #endif
 
-       SMB_WARN(have_profiling_clock == False,
+       SMB_WARN(have_profiling_clock == True,
                ("could not find a working clock for profiling"));
-       return have_profiling_clock;
+       return;
 }
 #endif
 

Reply via email to