mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* HZ from userspace
@ 2008-08-06 20:48 Piotr Jaroszyński
  2008-08-06 21:49 ` Ray Lee
  0 siblings, 1 reply; 7+ messages in thread
From: Piotr Jaroszyński @ 2008-08-06 20:48 UTC (permalink / raw)
  To: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 572 bytes --]

Hello,
I want to be able to convert starttime from /proc/#/stat to absolutetime and it seems that I need HZ to do that as it is measured injiffies. How can I get HZ? I have seen some discussion about this buthaven't found a definite answer. procps is using some hacks do it andI would prefer to avoid them.I only need a solution for modern kernels, say 2.6.20+ if that matters.
-- Best Regards,Piotr JaroszyÅ„skiÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HZ from userspace
  2008-08-06 20:48 HZ from userspace Piotr Jaroszyński
@ 2008-08-06 21:49 ` Ray Lee
  2008-08-06 22:07   ` Piotr Jaroszyński
  0 siblings, 1 reply; 7+ messages in thread
From: Ray Lee @ 2008-08-06 21:49 UTC (permalink / raw)
  To: Piotr Jaroszyński; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 693 bytes --]

On Wed, Aug 6, 2008 at 1:48 PM, Piotr Jaroszyński<p.jaroszynski@gmail.com> wrote:> Hello,>> 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).ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HZ from userspace
  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:19     ` Sven Wegener
  0 siblings, 2 replies; 7+ messages in thread
From: Piotr Jaroszyński @ 2008-08-06 22:07 UTC (permalink / raw)
  To: Ray Lee; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 760 bytes --]

>> 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 onlyreturns the default and not the real HZ used.
-- Best Regards,Piotr JaroszyÅ„skiÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HZ from userspace
  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
  1 sibling, 2 replies; 7+ messages in thread
From: Ray Lee @ 2008-08-06 22:16 UTC (permalink / raw)
  To: Piotr Jaroszyński; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 1131 bytes --]

On Wed, Aug 6, 2008 at 3:07 PM, Piotr Jaroszyński<p.jaroszynski@gmail.com> 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.
I believe the claim that it's out of date is out of date. manpages3.0.1 has an update to this, according to a message I saw on this lista month or so ago.
Regardless, the fields you're reading should all be showing USER_HZwhich is fixed at 100 per second regardless of the underlying kernelHZ parameter.
Try it.ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HZ from userspace
  2008-08-06 22:07   ` Piotr Jaroszyński
  2008-08-06 22:16     ` Ray Lee
@ 2008-08-06 22:19     ` Sven Wegener
  1 sibling, 0 replies; 7+ messages in thread
From: Sven Wegener @ 2008-08-06 22:19 UTC (permalink / raw)
  To: Piotr Jaroszyński; +Cc: Ray Lee, linux-kernel

[-- 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HZ from userspace
  2008-08-06 22:16     ` Ray Lee
@ 2008-08-06 22:20       ` Ray Lee
  2008-08-06 22:20       ` Piotr Jaroszyński
  1 sibling, 0 replies; 7+ messages in thread
From: Ray Lee @ 2008-08-06 22:20 UTC (permalink / raw)
  To: Piotr Jaroszyński; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 1402 bytes --]

On Wed, Aug 6, 2008 at 3:16 PM, Ray Lee <ray-lk@madrabbit.org> wrote:> On Wed, Aug 6, 2008 at 3:07 PM, Piotr Jaroszyński> <p.jaroszynski@gmail.com> 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.>> I believe the claim that it's out of date is out of date. manpages> 3.0.1 has an update to this, according to a message I saw on this list> a month or so ago.>> Regardless, the fields you're reading should all be showing USER_HZ> which is fixed at 100 per second regardless of the underlying kernel> HZ parameter.>> Try it.>
Here's the latest proc(5) man page from June 25, 2008. Look for_SC_CLK_TCK about a third of the way down.
http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.htmlÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HZ from userspace
  2008-08-06 22:16     ` Ray Lee
  2008-08-06 22:20       ` Ray Lee
@ 2008-08-06 22:20       ` Piotr Jaroszyński
  1 sibling, 0 replies; 7+ messages in thread
From: Piotr Jaroszyński @ 2008-08-06 22:20 UTC (permalink / raw)
  To: Ray Lee; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 1149 bytes --]

>>>> 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.>> I believe the claim that it's out of date is out of date. manpages> 3.0.1 has an update to this, according to a message I saw on this list> a month or so ago.>> Regardless, the fields you're reading should all be showing USER_HZ> which is fixed at 100 per second regardless of the underlying kernel> HZ parameter.>> Try it.
Ah ok, thanks a lot for info, will do.

-- Best regards,Piotr JaroszyÅ„skiÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-08-06 22:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-06 20:48 HZ from userspace 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 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®