Commit 809814a8 authored by Philip Carns's avatar Philip Carns

fix bug in perf calc for both darshan-parser and darshan-job-summary.pl;

if a file is opened but not read or written then don't try to calculate
the "lastio" metric for it.


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@400 3b7491f3-a168-0410-bf4b-c445ed680a29
parent fae57be9
......@@ -13,6 +13,7 @@
#include <time.h>
#include <stdlib.h>
#include <getopt.h>
#include <assert.h>
#include "darshan-logutils.h"
......@@ -733,15 +734,23 @@ void accum_perf(struct darshan_file *dfile,
if (dfile->fcounters[CP_F_READ_END_TIMESTAMP] >
dfile->fcounters[CP_F_WRITE_END_TIMESTAMP])
{
pdata->shared_time_by_open_lastio +=
dfile->fcounters[CP_F_READ_END_TIMESTAMP] -
dfile->fcounters[CP_F_OPEN_TIMESTAMP];
/* be careful: file may have been opened but not read or written */
if(dfile->fcounters[CP_F_READ_END_TIMESTAMP] > dfile->fcounters[CP_F_OPEN_TIMESTAMP])
{
pdata->shared_time_by_open_lastio +=
dfile->fcounters[CP_F_READ_END_TIMESTAMP] -
dfile->fcounters[CP_F_OPEN_TIMESTAMP];
}
}
else
{
pdata->shared_time_by_open_lastio +=
dfile->fcounters[CP_F_WRITE_END_TIMESTAMP] -
dfile->fcounters[CP_F_OPEN_TIMESTAMP];
/* be careful: file may have been opened but not read or written */
if(dfile->fcounters[CP_F_WRITE_END_TIMESTAMP] > dfile->fcounters[CP_F_OPEN_TIMESTAMP])
{
pdata->shared_time_by_open_lastio +=
dfile->fcounters[CP_F_WRITE_END_TIMESTAMP] -
dfile->fcounters[CP_F_OPEN_TIMESTAMP];
}
}
/* by_cumul */
......
......@@ -1237,13 +1237,19 @@ sub process_file_record
if($file_record{'CP_F_READ_END_TIMESTAMP'} >
$file_record{'CP_F_WRITE_END_TIMESTAMP'})
{
$shared_file_time += $file_record{'CP_F_READ_END_TIMESTAMP'} -
$file_record{'CP_F_OPEN_TIMESTAMP'};
# be careful of files that were opened but not read or
# written
if($file_record{'CP_F_READ_END_TIMESTAMP'} > $file_record{'CP_F_OPEN_TIMESTAMP'}) {
$shared_file_time += $file_record{'CP_F_READ_END_TIMESTAMP'} -
$file_record{'CP_F_OPEN_TIMESTAMP'};
}
}
else
{
$shared_file_time += $file_record{'CP_F_WRITE_END_TIMESTAMP'} -
$file_record{'CP_F_OPEN_TIMESTAMP'};
if($file_record{'CP_F_WRITE_END_TIMESTAMP'} > $file_record{'CP_F_OPEN_TIMESTAMP'}) {
$shared_file_time += $file_record{'CP_F_WRITE_END_TIMESTAMP'} -
$file_record{'CP_F_OPEN_TIMESTAMP'};
}
}
}
}
......
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