]> git.ozlabs.org Git - ccan/blobdiff - ccan/timer/timer.h
timer: increase default span to 5.
[ccan] / ccan / timer / timer.h
index 7b5d199470c49e829aa19c0363eaa715c6324fee..65f849b3dccc22743ed958a6d36ddb04370c2b65 100644 (file)
@@ -5,10 +5,15 @@
 #include <ccan/list/list.h>
 #include <stdint.h>
 
+#ifndef TIMER_GRANULARITY
 /* We divide all nsec values by 1000, reducing it to usec granularity. */
 #define TIMER_GRANULARITY 1000
-/* This gives 16 pointers per level, up to 13 levels deep. */
-#define TIMER_LEVEL_BITS 4
+#endif
+
+#ifndef TIMER_LEVEL_BITS
+/* This gives 32 pointers per level, up to 13 levels deep. */
+#define TIMER_LEVEL_BITS 5
+#endif
 
 struct timers;
 struct timer;
@@ -61,7 +66,7 @@ void timer_del(struct timers *timers, struct timer *timer);
  * timers.  Otherwise, it sets @first to the expiry time of the first
  * timer (rounded to TIMER_GRANULARITY nanoseconds), and returns true.
  */
-bool timer_earliest(const struct timers *timers, struct timespec *first);
+bool timer_earliest(struct timers *timers, struct timespec *first);
 
 /**
  * timer_expire - update timers structure and remove expired timers.
@@ -123,6 +128,7 @@ struct timers {
        /* Far in the future. */
        struct list_head far;
        uint64_t base;
+       uint64_t first;
 
        struct timer_level *level[(64 + TIMER_LEVEL_BITS-1) / TIMER_LEVEL_BITS];
 };