This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: a way to read the current cpu load from the shell or via a cmdline utility in cygwin?
> >The values seem to be a factor of 10 out.
> >This is because Linux uses a value of 100 for HZ, whereas Cygwin has this
> >defined as 1000. The /proc implementation uses 100 and ignores the Cygwin
> >value.
>
> Is the cygwin value wrong? Should we change it?
Which value you pick is completely arbitary. I chose 100 because that's the
same as Linux. I could just as easily re-write the /proc stuff to use HZ
from sys/param.h instead. The procps proc/sysinfo.c file has code to
automatically work out what value of HZ is being used by the kernel, so
existing binaries would still work without re-compilation.
The author of procps has this to say:
* Some values in /proc are expressed in units of 1/HZ seconds, where HZ
* is the kernel clock tick rate. One of these units is called a jiffy.
* The HZ value used in the kernel may vary according to hacker desire.
* According to Linus Torvalds, this is not true. He considers the values
* in /proc as being in architecture-dependant units that have no relation
* to the kernel clock tick rate. Examination of the kernel source code
* reveals that opinion as wishful thinking.
So, no, I don't think it should be changed. Well written programs should be
able to cope with this. I will modify fhandler_process.cc and
fhandler_proc.cc to use HZ from sys/param.h.
Chris
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/