bug-hurd
[Top][All Lists]
Advanced

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

address@hidden: [PATCH] Make __getclktck return 100 for the Hurd]


From: Richard Braun
Subject: address@hidden: [PATCH] Make __getclktck return 100 for the Hurd]
Date: Wed, 12 Jun 2013 00:26:08 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

----- Forwarded message from Richard Braun <address@hidden> -----

Date: Mon,  6 May 2013 21:49:56 +0200
From: Richard Braun <address@hidden>
To: address@hidden
Subject: [PATCH] Make __getclktck return 100 for the Hurd
X-Mailer: git-send-email 1.7.2.5

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



----- End forwarded message -----

Forwarding to libc-alpha for reviewing. Thanks.

-- 
Richard Braun



reply via email to

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