bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] Make __getclktck return 100 for the Hurd


From: Richard Braun
Subject: [PATCH] Make __getclktck return 100 for the Hurd
Date: Mon, 6 May 2013 21:49:56 +0200

While it's true that Mach time values are returned in microseconds, they
are correctly handled as such, and not as clock ticks, by applications.
On the other hand, tools such as top provide wrong results since values
in /proc are actually provided as true clock ticks.
---
 sysdeps/mach/hurd/getclktck.c |    5 ++---
 sysdeps/mach/hurd/setitimer.c |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/sysdeps/mach/hurd/getclktck.c b/sysdeps/mach/hurd/getclktck.c
index 5ea4781..feebd56 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 8b012ec..b33e7cf 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)
-- 
1.7.10.4




reply via email to

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