From: Sven Wegener <sven.wegener@stealer.net>
To: "Piotr Jaroszyński" <p.jaroszynski@gmail.com>
Cc: Ray Lee <ray-lk@madrabbit.org>, linux-kernel@vger.kernel.org
Subject: Re: HZ from userspace
Date: Thu, 7 Aug 2008 00:19:40 +0200 (CEST) [thread overview]
Message-ID: <alpine.LNX.1.10.0808070010260.5671@titan.stealer.net> (raw)
In-Reply-To: <d77765540808061507v47561931x23a23c30067bc57b@mail.gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 995 bytes --]
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
prev parent reply other threads:[~2008-08-06 22:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 20:48 Piotr Jaroszyński
2008-08-06 21:49 ` Ray Lee
2008-08-06 22:07 ` Piotr Jaroszyński
2008-08-06 22:16 ` Ray Lee
2008-08-06 22:20 ` Ray Lee
2008-08-06 22:20 ` Piotr Jaroszyński
2008-08-06 22:19 ` Sven Wegener [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.1.10.0808070010260.5671@titan.stealer.net \
--to=sven.wegener@stealer.net \
--cc=linux-kernel@vger.kernel.org \
--cc=p.jaroszynski@gmail.com \
--cc=ray-lk@madrabbit.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®