Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 9600 - sysconf(_SC_CLK_TCK) reports 100 when HZ=1000
Summary: sysconf(_SC_CLK_TCK) reports 100 when HZ=1000
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-24 04:51 UTC by Denys Duchier
Modified: 2002-10-26 10:32 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
illustrates the problem (foo.cc,702 bytes, text/plain)
2002-10-24 07:15 UTC, Denys Duchier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denys Duchier 2002-10-24 04:51:56 UTC
times(2) reports the number of ticks since boot and  
sysconf(_SC_CLK_TCK) is supposed to give the number of  
ticks per second.  However the value (100) reported by  
sysconf(_SC_CLK_TCK) is clearly 10 times too low as a  
simple experiment using a wall clock reveals.  
  
I noticed this problem because the soft timers implemented  
by the Mozart/Oz VM (relying on times(2) and _SC_CLK_TCK) 
were firing too quickly.  
  
I do not know what severity to assign.  For me, it is quite  
high since it screws up my VM, but I imagine not many people  
are in this situation. I leave it as normal, but I consider 
it major.
Comment 1 Denys Duchier 2002-10-24 07:15:42 UTC
Created attachment 4967 [details]
illustrates the problem

running this testcase on my machine produces the following output:

according to gettimeofday: 5000
according to ticks: 50010
sysconf(_SC_CLK_TCK)=100

either times is wrong or sysconf(_SC_CLK_TCK) is wrong. either way,
time computing according to ticks is off by a factor of 10.
Comment 2 Bjoern Brauel (RETIRED) gentoo-dev 2002-10-24 16:03:03 UTC
This is a glibc *inconsistency*. Glibc hardwires that on i386 jiffies is always
100 and 1024 on alpha for example. Its not possible to provide a quick fix for
that. Such a solution would require a couple of changes to kernel and glibc.
Note that the jiffies patch to kernel 2.4 still is *experimental* . There are
other possible problems associated to it as well. So in case this is critical
for you , set the jiffies back to 100 in the kernel configuration. I will check
what glibc2.3 does though.
Comment 3 Denys Duchier 2002-10-24 19:35:00 UTC
no, I am now checking for the bug in our configure script and 
adjusting the computation using the appropriate ratio. Since 
you confirm that this is a glibc bug (which btw the way I tried 
to check before reporting the problem and could not locate in their 
bug db), I imagine that it will pop up in other systems as well. 
my problem is that I need to make the compilation of our VM robust 
in the face of such eventualities.  I could of course change the 
jiffies thing on my machine, but that would not help users of our 
VM on other systems. I just hope you know whom to bug about it :-) 
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-26 10:32:09 UTC
As bjb said, the jiffies patch is experimental, and from own experience do
have some issues with some drivers.

If the glibc guys will fix it for you, reopen this with the patch, or
URL to it, else change your jiffies to the default 100.