Re: Collecting Data in an Output File

From: Errin Larsen (errinlarsen_at_gmail.com)
Date: 08/31/04


Date: Tue, 31 Aug 2004 14:25:31 -0500
To: cdevers@pobox.com

On Tue, 31 Aug 2004 14:07:14 -0400 (EDT), Chris Devers
<cdevers@pobox.com> wrote:
> On Tue, 31 Aug 2004, Errin Larsen wrote:
>
> > I am collecting temperature data from the CPUs in my system.

<<SNIP>>

> This is nitpicking, but have you considered inverting that? A format
> like this might be easier to work with:
>
> time,cpu1,cpu2,cpu3
> Tue Aug 31 12:00:00 EDT 2004,65,65,64
> Tue Aug 31 13:00:00 EDT 2004,63,64,65
> Tue Aug 31 14:00:00 EDT 2004,62,64,66
> Tue Aug 31 15:00:00 EDT 2004,64,62,64
>
> This way, you can simply append to the file with the timestamp and the
> readings from each of the CPUs you're monitoring, rather than having to
> open the file and append to each line.
>
> The downside is that if you add CPUs, the file falls apart because you
> need to add / change / remove a column. The fix for this is to just have
> one CPU per line, and identify it:
>
> time,cpu,temp
> Tue Aug 31 12:00:00 EDT 2004,cpu1,65
> Tue Aug 31 12:00:00 EDT 2004,cpu2,65
> Tue Aug 31 12:00:00 EDT 2004,cpu3,64
> ...
>
> This is more verbose, obviously, but also more flexible.

The above is good stuff. I'll work on this. There are some problems,
but I'll get to them below.

>
> > How can I read in all the lines into their on arrays and add some data
> > to the end?
>
> For the one I've got above, it would be something like...
>
> while ( <> ) {
> my ($ts, $cpu, $temp) = split("," $_);
> push (@{ $processors{$cpu} }, $temp);
> }
>
> Then to get at the data, do something like
>
> foreach $cpu ( sort keys %processors ) {
> print "$cpu: @{ $processors{ $cpu }}\n"
> }
>
> ...or something like that...

<<SNIP>>

Thanks Chris. This is the sort of thing I was looking for! Now I'll
go play with your suggestions some. The problem I'm gonna have is
that the file format I suggested is really what I need. HOWEVER, I
don't need that format when I'm collecting the data, just when I get
ready to use that data. So I think I'll try collecting it as you
suggest in the 2nd suggestion above, and then work on a script that
will convert THAT file into the format I need. Thanks again!

--Errin



Relevant Pages

  • Re: [Patch][RFC] Disabling per-tgid stats on task exit in taskstats
    ... Hog tying cpusets and process accounting together seems just ... How about a simple way to disable collection on specified CPUs. ... Collecting this sort of data makes sense for certain managed system ... I propose a per-cpu boolean flag to disable collection. ...
    (Linux-Kernel)
  • Re: Faster encoding?
    ... counting audio and video). ... I do not have experience with Intel CPUs. ... It depends on the format the AVI is compressed in: ... -- // Alessandro Angeli ...
    (microsoft.public.windowsmedia.encoder)
  • Re: Faster encoding?
    ... > I do not have experience with Intel CPUs. ... > It depends on the format the AVI is compressed in: ... > be noticeably faster, but only up to a point, because than ...
    (microsoft.public.windowsmedia.encoder)
  • Re: [Lse-tech] [PATCH] new bitmap list format (for cpusets)
    ... > Cpusets provide a way to manage subsets of CPUs and Memory Nodes ... > directly via this file system, ... > will get bigger) via hex mask strings is painful for humans. ... > The intention is to provide a format for the cpu and memory mask files ...
    (Linux-Kernel)
  • Re: M2N32-SLI Deluxe: System Turns Off after 5 Seconds of Turning On
    ... CPUs do go bad, but rarely in my experience, and then mainly caused by ... Thanks for the suggestion. ... Will keep that in mind next time. ... Best regards, ...
    (alt.comp.periphs.mainboard.asus)