Commit 62d4743e authored by Philip Carns's avatar Philip Carns

implement new approach to handling TIMESTAMP offsets; the library now

normalizes timestamps at runtime


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@834 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 63cec022
......@@ -19,7 +19,7 @@
#endif
/* update this on file format changes */
#define CP_VERSION "2.02"
#define CP_VERSION "2.03"
/* magic number for validating output files and checking byte order */
#define CP_MAGIC_NR 6567223
......@@ -200,6 +200,9 @@ enum darshan_indices
/* floating point statistics */
enum f_darshan_indices
{
/* NOTE: adjust cp_normalize_timestamps() function if any TIMESTAMPS are
* added or modified in this list
*/
CP_F_OPEN_TIMESTAMP = 0, /* timestamp of first open */
CP_F_READ_START_TIMESTAMP, /* timestamp of first read */
CP_F_WRITE_START_TIMESTAMP, /* timestamp of first write */
......
......@@ -121,6 +121,7 @@ struct darshan_job_runtime
int file_count;
struct darshan_file_runtime* name_table[CP_HASH_SIZE];
struct darshan_file_ref* handle_table[CP_HASH_SIZE];
double wtime_offset;
char* trailing_data;
};
......
......@@ -179,6 +179,7 @@ extern char* __progname;
CP_F_SET(file, CP_F_READ_END_TIMESTAMP, __tm2); \
} while(0)
static void cp_normalize_timestamps(struct darshan_job_runtime* final_job);
static void cp_log_construct_indices(struct darshan_job_runtime* final_job,
int rank, int* inout_count, int* lengths, void** pointers, char*
trailing_data);
......@@ -537,6 +538,9 @@ void darshan_shutdown(int timing_flag)
DARSHAN_MPI_CALL(PMPI_Allreduce)(&local_ret, &all_ret, 1, MPI_INT, MPI_LOR,
MPI_COMM_WORLD);
/* adjust timestamps in any remaining records */
cp_normalize_timestamps(final_job);
/* if we are using any hints to write the log file, then record those
* hints in the log file header
*/
......@@ -2484,6 +2488,25 @@ void darshan_mnt_id_from_path(const char* path, int64_t* device_id, int64_t* blo
return;
}
/* iterates through counters and adjusts timestamps to be relative to
* MPI_Init()
*/
static void cp_normalize_timestamps(struct darshan_job_runtime* final_job)
{
int i;
int j;
for(i=0; i<final_job->file_count; i++)
{
for(j=CP_F_OPEN_TIMESTAMP; j<=CP_F_WRITE_END_TIMESTAMP; j++)
{
final_job->file_array[i].fcounters[j] -= final_job->wtime_offset;
}
}
return;
}
/*
* Local variables:
* c-indent-level: 4
......
......@@ -1306,6 +1306,7 @@ void darshan_initialize(int argc, char** argv, int nprocs, int rank)
darshan_global_job->log_job.uid = getuid();
darshan_global_job->log_job.start_time = time(NULL);
darshan_global_job->log_job.nprocs = nprocs;
darshan_global_job->wtime_offset = posix_wtime();
my_rank = rank;
/* record exe and arguments */
......
......@@ -369,7 +369,13 @@ int darshan_log_getjob(darshan_fd file, struct darshan_job *job)
return(-1);
}
if(strcmp(file->version, "2.02") == 0)
if(strcmp(file->version, "2.03") == 0)
{
getjob_internal = getjob_internal_201;
getfile_internal = getfile_internal_200;
file->job_struct_size = sizeof(*job);
}
else if(strcmp(file->version, "2.02") == 0)
{
getjob_internal = getjob_internal_201;
getfile_internal = getfile_internal_200;
......@@ -729,15 +735,23 @@ void darshan_log_close(darshan_fd file)
*/
void darshan_log_print_version_warnings(struct darshan_job *job)
{
if(strcmp(job->version_string, "2.02") == 0)
if(strcmp(job->version_string, "2.03") == 0)
{
/* current version */
return;
}
if(strcmp(job->version_string, "2.02") == 0)
{
printf("# WARNING: version 2.01 log format has the following limitations:\n");
printf("# - *_TIMESTAMP fields are not normalized relative to MPI_Init() time.\n");
return;
}
if(strcmp(job->version_string, "2.01") == 0)
{
printf("# WARNING: version 2.01 log format has the following limitations:\n");
printf("# - *_TIMESTAMP fields are not normalized relative to MPI_Init() time.\n");
printf("# - inaccurate statistics in some multi-threaded cases.\n");
return;
}
......@@ -745,6 +759,7 @@ void darshan_log_print_version_warnings(struct darshan_job *job)
if(strcmp(job->version_string, "2.00") == 0)
{
printf("# WARNING: version 2.00 log format has the following limitations:\n");
printf("# - *_TIMESTAMP fields are not normalized relative to MPI_Init() time.\n");
printf("# - inaccurate statistics in some multi-threaded cases.\n");
return;
}
......@@ -761,6 +776,7 @@ void darshan_log_print_version_warnings(struct darshan_job *job)
printf("# CP_F_VARIANCE_RANK_TIME\n");
printf("# CP_F_VARIANCE_RANK_BYTES\n");
printf("# WARNING: version 1.24 log format has the following limitations:\n");
printf("# - *_TIMESTAMP fields are not normalized relative to MPI_Init() time.\n");
printf("# - does not store the job id in the file.\n");
printf("# - inaccurate statistics in some multi-threaded cases.\n");
return;
......@@ -778,6 +794,7 @@ void darshan_log_print_version_warnings(struct darshan_job *job)
printf("# CP_F_VARIANCE_RANK_TIME\n");
printf("# CP_F_VARIANCE_RANK_BYTES\n");
printf("# WARNING: version 1.23 log format has the following limitations:\n");
printf("# - *_TIMESTAMP fields are not normalized relative to MPI_Init() time.\n");
printf("# - may have incorrect mount point mappings for files with rank > 0.\n");
printf("# - does not store the job id in the file.\n");
printf("# - inaccurate statistics in some multi-threaded cases.\n");
......@@ -798,6 +815,7 @@ void darshan_log_print_version_warnings(struct darshan_job *job)
printf("# CP_F_VARIANCE_RANK_TIME\n");
printf("# CP_F_VARIANCE_RANK_BYTES\n");
printf("# WARNING: version 1.22 log format has the following limitations:\n");
printf("# - *_TIMESTAMP fields are not normalized relative to MPI_Init() time.\n");
printf("# - does not record mounted file systems, mount points, or fs types.\n");
printf("# - attributes syncs to cumulative metadata time, rather than cumulative write time.\n");
printf("# - does not store the job id in the file.\n");
......@@ -826,6 +844,7 @@ void darshan_log_print_version_warnings(struct darshan_job *job)
printf("# CP_F_VARIANCE_RANK_TIME\n");
printf("# CP_F_VARIANCE_RANK_BYTES\n");
printf("# WARNING: version 1.21 log format has the following limitations:\n");
printf("# - *_TIMESTAMP fields are not normalized relative to MPI_Init() time.\n");
printf("# - does not record mounted file systems, mount points, or fs types.\n");
printf("# - attributes syncs to cumulative metadata time, rather than cumulative write time.\n");
printf("# - does not store the job id in the file.\n");
......
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