Commit b1434ce8 authored by Philip Carns's avatar Philip Carns
Browse files

incremental progress on aggregating histograms, needs more work


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@158 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 1ecd4cee
...@@ -189,6 +189,19 @@ sub add_histogram ...@@ -189,6 +189,19 @@ sub add_histogram
# $_[1] is the data structure we are adding to # $_[1] is the data structure we are adding to
my $name = $_[2]; # name of the histogram my $name = $_[2]; # name of the histogram
# save some global values; we need to replace/adjust those manually
# after adding in the histogram because we no longer know the actual
# value of each data point
my $old_count = $_[1]->{count};
my $old_total_val = $_[1]->{total_val};
my $old_min_val = $_[1]->{min_val};
my $old_max_val = $_[1]->{max_val};
my $count = 0;
my $average = 0;
my $min = 0;
my $max = 0;
seek($file, 0, 0); seek($file, 0, 0);
while($line = <$file>) while($line = <$file>)
...@@ -198,16 +211,33 @@ sub add_histogram ...@@ -198,16 +211,33 @@ sub add_histogram
{ {
while($line = <$file>) while($line = <$file>)
{ {
# stop when we hit a blank line if($line =~ /^count,(.*),/) {$count = $1;}
if($line =~ /^\s*$/) elsif($line =~ /^average,(.*),/) {$average = $1;}
elsif($line =~ /^min,(.*),/) {$min = $1;}
elsif($line =~ /^max,(.*),/) {$max = $1;}
elsif($line =~ /^bucket min,bucket max,/) {} # key
elsif($line =~
/^([0-9]*\.?[0-9]*),([0-9]*\.?[0-9]*),([0-9]*\.?[0-9]*),([0-9]*\.?[0-9]*),([0-9]*\.?[0-9]*),([0-9]*\.?[0-9]*),([0-9]*\.?[0-9]*),([0-9]*\.?[0-9]*)/)
{
$_[1]->add(($6/$3), $3);
}
elsif($line =~ /^\s*$/)
{ {
# stop when we hit a blank line
last; last;
} }
else
{
print $line;
die("Error: poorly formated csv file.\n");
}
} }
last; last;
} }
} }
# TODO: fix min/max
seek($file, 0, 0); seek($file, 0, 0);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment