[PLUG] perl reading /proc/loadavg

Randy.Dunlap rddunlap at osdl.org
Thu Mar 21 23:32:54 UTC 2002


On Thu, 21 Mar 2002, Curtis Poe wrote:

| ----- Original Message -----
| From: <lemming at attbi.com>
| To: <plug at lists.pdxlinux.org>
| Sent: Thursday, March 21, 2002 3:12 PM
| Subject: Re: [PLUG] perl reading /proc/loadavg
|
|
| > Because you're still reading the same file as it was
| > when you first opened it.
| > Instead of seek, etc... just reopen the file.
| >
| > -Mark
|
| Mark,
|
| Did you test that?  Seek will position the filehandle at the appropriate
| position on disk.  If the contents there change, whatever you read should
| change.  Am I totally misunderstanding how this works with /proc/loadavg?

Well I think that you are correct, since that's what I tried to do.

And it works for me for /proc/stat and /proc/meminfo,
but they contain multiple lines...if that matters.
But I'm also using hashing to take selected lines from
stat and meminfo, and not doing this for loadavg.

-- 
~Randy





More information about the PLUG mailing list