lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 7 Aug 2008 00:19:40 +0200 (CEST)
From:	Sven Wegener <sven.wegener@...aler.net>
To:	Piotr Jaroszyński <p.jaroszynski@...il.com>
cc:	Ray Lee <ray-lk@...rabbit.org>, linux-kernel@...r.kernel.org
Subject: Re: HZ from userspace

On Wed, 6 Aug 2008, Piotr Jaroszyński wrote:

> >> I want to be able to convert starttime from /proc/#/stat to absolute
> >> time and it seems that I need HZ to do that as it is measured in
> >> jiffies. How can I get HZ? I have seen some discussion about this but
> >> haven't found a definite answer. procps is using some hacks do it and
> >> I would prefer to avoid them.
> >> I only need a solution for modern kernels, say 2.6.20+ if that matters.
> >
> > `man sysconf`, in particular you want sysconf(_SC_CLK_TCK).
> 
> manpage says it's obsolete and i read in some discussion that it only
> returns the default and not the real HZ used.

You can get the information via two ways. At compile time, that is the 
variable CLK_TCK and this way has been obsoleted. The other way is at 
runtime via sysconf(_SC_CLK_TCK) and that is still valid. You don't need 
the real HZ, because the kernel converts it to USER_HZ, which is currently 
100 on x86 for historic reasons.

Sven

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ