Commit a79aaa6c authored by Philip Carns's avatar Philip Carns

initialize histograms, and stub out routine to find and parse specific

histograms in input files


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@156 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 8883c133
......@@ -36,12 +36,56 @@ my $skipped_snapshot = 0;
my $total_cap_used = 0;
my $total_size = 0;
my ($size_histo,
$cap_histo,
$pos_ovhd_histo,
$neg_ovhd_histo,
$dir_histo,
$dirkb_histo,
$fname_histo,
$slink_histo,
$hlink_histo,
$mtime_files_histo,
$mtime_bytes_histo,
$ctime_files_histo,
$ctime_bytes_histo,
$atime_files_histo,
$atime_bytes_histo);
# initialize new histogram data structures (copied from fsstats program)
$size_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
$cap_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
$pos_ovhd_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
$neg_ovhd_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
$dir_histo = Histo->new(min => 0, incr => 1, log_incr => 1);
$dirkb_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
#Be careful in choosing the value of 'max' for histos.
#If the log_incr is set for them, the largest value+1 in the last bucket will be a power of 2.
#If it is not set the largest value+1 in the last bucket will be some multiple of the 'max' value.
#To be able to toggle log_incr off and on without having to change anything else 'max' should be
#chosen carefully. Otherwise results may look wrong.
#Hence if the max value chosen is 'n', then n+1 should be a power of 2. And n+1 should also be a
#multiple of the 'incr' value.
#Dont play with min values.
# $fname_histo = Histo->new(min => 0, max => 120, incr => 8);
$fname_histo = Histo->new(min => 0, max => 127, incr => 8);
# $slink_histo = Histo->new(min => 0, max => 120, incr => 8);
$slink_histo = Histo->new(min => 0, max => 127, incr => 8);
$hlink_histo = Histo->new(min => 0, incr => 1, log_incr => 1);
$mtime_files_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
$mtime_bytes_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
$ctime_files_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
$ctime_bytes_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
$atime_files_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
$atime_bytes_histo = Histo->new(min => 0, incr => 1, log_incr => 1, integer_vals => 0);
# loop through specified csv files
foreach my $file ( @csv_files )
{
open(CSV, "$file") || die("Error opening file $file: $!\n");
add_summary(CSV);
add_histogram(CSV, $size_histo, "file size");
close(CSV);
}
......@@ -135,6 +179,38 @@ sub add_summary
seek($file, 0, 0);
}
# add_histogram()
#
# finds the specified histogram in a csv file and sums it to the existing
# histogram data structure
sub add_histogram
{
my $file = $_[0]; # open file handle
# $_[1] is the data structure we are adding to
my $name = $_[2]; # name of the histogram
seek($file, 0, 0);
while($line = <$file>)
{
# look for specified histogram
if($line =~ /^histogram,$name$/)
{
while($line = <$file>)
{
# stop when we hit a blank line
if($line =~ /^\s*$/)
{
last;
}
}
last;
}
}
seek($file, 0, 0);
}
# convert a printable value to KB
sub print_to_kb {
my ($arg) = @_;
......
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