[SCM] Samba Shared Repository - branch master updated

Simo Sorce idra at samba.org
Fri Jul 5 08:48:04 MDT 2013


The branch, master has been updated
       via  cf87f85 time: prefer CLOCK_BOOTTIME for clock_gettime_mono()
       via  e3c2dd1 time: don't try to use the coarse clock
      from  2bdaf53 VERSION: change to 4.2.0pre1

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit cf87f8587415df2119995e82ccf51bb64e44115b
Author: Björn Jacke <bj at sernet.de>
Date:   Wed Jul 3 18:57:57 2013 +0200

    time: prefer CLOCK_BOOTTIME for clock_gettime_mono()
    
    this clock moves on while the machine was suspended. This is what we prefer
    actually.
    
    Signed-off-by: Björn Jacke <bj at sernet.de>
    Reviewed-by: Simo Sorce <idra at samba.org>
    
    Autobuild-User(master): Simo Sorce <idra at samba.org>
    Autobuild-Date(master): Fri Jul  5 16:47:34 CEST 2013 on sn-devel-104

commit e3c2dd13d4519d89fc78fd36a9ee4552f0f241ac
Author: Björn Jacke <bj at sernet.de>
Date:   Wed Jul 3 18:51:14 2013 +0200

    time: don't try to use the coarse clock
    
    as we prefer to use the suspend aware CLOCK_BOOTTIME as monotonic clock source
    we cannot deal with the mono coarse clock any more. Actually I never saw a real
    performance gain with it.
    
    Signed-off-by: Björn Jacke <bj at sernet.de>
    Reviewed-by: Simo Sorce <idra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/util/time.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/time.c b/lib/util/time.c
index 56b2ec5..05251dd 100644
--- a/lib/util/time.c
+++ b/lib/util/time.c
@@ -62,26 +62,29 @@ a wrapper to preferably get the monotonic time
 **/
 _PUBLIC_ void clock_gettime_mono(struct timespec *tp)
 {
-	if (clock_gettime(CUSTOM_CLOCK_MONOTONIC,tp) != 0) {
-		clock_gettime(CLOCK_REALTIME,tp);
+/* prefer a suspend aware monotonic CLOCK_BOOTTIME: */
+#ifdef CLOCK_BOOTTIME
+	if (clock_gettime(CLOCK_BOOTTIME,tp) == 0) {
+		return;
+	}
+#endif
+/* then try the  monotonic clock: */
+#if CUSTOM_CLOCK_MONOTONIC != CLOCK_REALTIME
+	if (clock_gettime(CUSTOM_CLOCK_MONOTONIC,tp) == 0) {
+		return;
 	}
+#endif
+	clock_gettime(CLOCK_REALTIME,tp);
 }
 
 /**
 a wrapper to preferably get the monotonic time in seconds
-as this is only second resolution we can use the cached
-(and much faster) COARSE clock variant
 **/
 _PUBLIC_ time_t time_mono(time_t *t)
 {
 	struct timespec tp;
-	int rc = -1;
-#ifdef CLOCK_MONOTONIC_COARSE
-	rc = clock_gettime(CLOCK_MONOTONIC_COARSE,&tp);
-#endif
-	if (rc != 0) {
-		clock_gettime_mono(&tp);
-	}
+
+	clock_gettime_mono(&tp);
 	if (t != NULL) {
 		*t = tp.tv_sec;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list