summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-08-27 11:35:31 +0200
committerRichard Braun <rbraun@sceen.net>2013-08-27 11:35:31 +0200
commitd57f2f9b4bd007846af2fb4217486ea572579010 (patch)
tree9e3bcfa444c2a5cfe0460295d80f9e93713af49f
parent83fed41a9ed81db6ca517185aefb296f74868c2f (diff)
Express CPU time (clock_t) in centisecondsrbraun/clock_t_centiseconds
-rw-r--r--sysdeps/mach/hurd/clock.c8
-rw-r--r--sysdeps/mach/hurd/getclktck.c5
-rw-r--r--sysdeps/mach/hurd/setitimer.c2
-rw-r--r--sysdeps/mach/hurd/times.c2
4 files changed, 8 insertions, 9 deletions
diff --git a/sysdeps/mach/hurd/clock.c b/sysdeps/mach/hurd/clock.c
index 61a66bee58..51f7abe96c 100644
--- a/sysdeps/mach/hurd/clock.c
+++ b/sysdeps/mach/hurd/clock.c
@@ -44,10 +44,10 @@ clock (void)
if (err)
return __hurd_fail (err);
- total = bi.user_time.seconds * 1000000 + bi.user_time.microseconds;
- total += tti.user_time.seconds * 1000000 + tti.user_time.microseconds;
- total += bi.system_time.seconds * 1000000 + bi.system_time.microseconds;
- total += tti.system_time.seconds * 1000000 + tti.system_time.microseconds;
+ total = bi.user_time.seconds * 100 + bi.user_time.microseconds / 10000;
+ total += tti.user_time.seconds * 100 + tti.user_time.microseconds / 10000;
+ total += bi.system_time.seconds * 100 + bi.system_time.microseconds / 10000;
+ total += tti.system_time.seconds * 100 + tti.system_time.microseconds / 10000;
return total;
}
diff --git a/sysdeps/mach/hurd/getclktck.c b/sysdeps/mach/hurd/getclktck.c
index 69be2cc352..5f7d9463af 100644
--- a/sysdeps/mach/hurd/getclktck.c
+++ b/sysdeps/mach/hurd/getclktck.c
@@ -18,12 +18,11 @@
#include <time.h>
-/* Return frequency of `times'.
- Since Mach reports CPU times in microseconds, we always use 1 million. */
+/* Return frequency of `times'. */
int
__getclktck ()
{
- return 1000000;
+ return 100;
}
/* Before glibc 2.2, the Hurd actually did this differently, so we
diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
index 39b6b161e8..4992c8973e 100644
--- a/sysdeps/mach/hurd/setitimer.c
+++ b/sysdeps/mach/hurd/setitimer.c
@@ -42,7 +42,7 @@ quantize_timeval (struct timeval *tv)
static time_t quantum = -1;
if (quantum == -1)
- quantum = 1000000 / __getclktck ();
+ quantum = 100 / __getclktck ();
tv->tv_usec = ((tv->tv_usec + (quantum - 1)) / quantum) * quantum;
if (tv->tv_usec >= 1000000)
diff --git a/sysdeps/mach/hurd/times.c b/sysdeps/mach/hurd/times.c
index 9e13a75f5e..593c33aaf6 100644
--- a/sysdeps/mach/hurd/times.c
+++ b/sysdeps/mach/hurd/times.c
@@ -29,7 +29,7 @@
static inline clock_t
clock_from_time_value (const time_value_t *t)
{
- return t->seconds * 1000000 + t->microseconds;
+ return t->seconds * 100 + t->microseconds / 10000;
}
/* Store the CPU time used by this process and all its