bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/4] Add a monotonic time variable


From: Pino Toscano
Subject: [PATCH 3/4] Add a monotonic time variable
Date: Fri, 26 Aug 2011 20:29:42 +0200

* kern/mach_clock.c (monotonic, mmonotonic): New variables.
(clock_interrupt): Call `time_value_add_usec' also on `monotonic', and
`update_mapped_time' also for `mmonotonic'.
(mapable_time_init): Call `mapable_time_init_time' also `monotonic' and
`mmonotonic'.
---
 kern/mach_clock.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index 459a290..1e3b88e 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -71,6 +71,7 @@ void mapable_time_init_time();        /* forward */
 int            hz = HZ;                /* number of ticks per second */
 int            tick = (1000000 / HZ);  /* number of usec per tick */
 time_value_t   time = { 0, 0 };        /* time since bootup (uncorrected) */
+time_value_t   monotonic = { 0, 0 };   /* time since bootup (uncorrected) */
 unsigned long  elapsed_ticks = 0;      /* ticks elapsed since bootup */
 
 int            timedelta = 0;
@@ -96,6 +97,7 @@ int           bigadj = 1000000;       /* adjust 10*tickadj if 
adjustment
  */
 
 mapped_time_value_t *mtime = 0;
+mapped_time_value_t *mmonotonic = 0;
 
 #define update_mapped_time(time, mtime)                                \
 MACRO_BEGIN                                                    \
@@ -221,6 +223,7 @@ void clock_interrupt(usec, usermode, basepri)
             */
            if (timedelta == 0) {
                time_value_add_usec(&time, usec);
+               time_value_add_usec(&monotonic, usec);
            }
            else {
                register int    delta;
@@ -234,8 +237,10 @@ void clock_interrupt(usec, usermode, basepri)
                    timedelta -= tickdelta;
                }
                time_value_add_usec(&time, delta);
+               time_value_add_usec(&monotonic, delta);
            }
            update_mapped_time(&time, mtime);
+           update_mapped_time(&monotonic, mmonotonic);
 
            /*
             *  Schedule soft-interupt for timeout if needed
@@ -497,6 +502,7 @@ host_adjust_time(host, new_adjustment, old_adjustment)
 void mapable_time_init()
 {
        mapable_time_init_time(&time, &mtime, "mapable_time_init_mtime");
+       mapable_time_init_time(&monotonic, &mmonotonic, 
"mapable_time_init_mmonotonic");
 }
 
 void mapable_time_init_time(time_v, mapped_time_v, what)
-- 
1.7.5.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]