Commit 755e6853 authored by Philip Carns's avatar Philip Carns
Browse files

Merge branch 'carns/issue-312-log-time-name' into 'master'

fix internal timing for finalize

Closes #312

See merge request !90
parents e245da9d d26bf896
......@@ -444,13 +444,20 @@ void darshan_core_shutdown()
darshan_core = NULL;
DARSHAN_CORE_UNLOCK();
/* NOTE: from this point on, this function must use
* darshan_core_wtime_absolute() rather than darshan_core_wtime() to
* collect timestamps for internal timing calculations. The former no
* longer works because it relies on runtime state to calculate
* timestamps relative to job start.
*/
/* grab some initial timing information */
#ifdef HAVE_MPI
/* if using mpi, sync across procs first */
if(using_mpi)
PMPI_Barrier(final_core->mpi_comm);
#endif
start_log_time = darshan_core_wtime();
start_log_time = darshan_core_wtime_absolute();
final_core->log_job_p->end_time = time(NULL);
if(getenv("DARSHAN_INTERNAL_TIMING"))
......@@ -524,31 +531,31 @@ void darshan_core_shutdown()
}
if(internal_timing_flag)
open1 = darshan_core_wtime();
open1 = darshan_core_wtime_absolute();
/* open the darshan log file */
ret = darshan_log_open(logfile_name, final_core, &log_fh);
if(internal_timing_flag)
open2 = darshan_core_wtime();
open2 = darshan_core_wtime_absolute();
/* error out if unable to open log file */
DARSHAN_CHECK_ERR(ret, "unable to create log file %s", logfile_name);
log_created = 1;
if(internal_timing_flag)
job1 = darshan_core_wtime();
job1 = darshan_core_wtime_absolute();
/* write the the compressed darshan job information */
ret = darshan_log_write_job_record(log_fh, final_core, &gz_fp);
if(internal_timing_flag)
job2 = darshan_core_wtime();
job2 = darshan_core_wtime_absolute();
/* error out if unable to write job information */
DARSHAN_CHECK_ERR(ret, "unable to write job record to file %s", logfile_name);
if(internal_timing_flag)
rec1 = darshan_core_wtime();
rec1 = darshan_core_wtime_absolute();
/* write the record name->id hash to the log file */
final_core->log_hdr_p->name_map.off = gz_fp;
ret = darshan_log_write_name_record_hash(log_fh, final_core, &gz_fp);
if(internal_timing_flag)
rec2 = darshan_core_wtime();
rec2 = darshan_core_wtime_absolute();
final_core->log_hdr_p->name_map.len = gz_fp - final_core->log_hdr_p->name_map.off;
/* error out if unable to write name records */
DARSHAN_CHECK_ERR(ret, "unable to write name records to log file %s", logfile_name);
......@@ -574,7 +581,7 @@ void darshan_core_shutdown()
}
if(internal_timing_flag)
mod1[i] = darshan_core_wtime();
mod1[i] = darshan_core_wtime_absolute();
/* if module is registered locally, perform module shutdown operations */
if(this_mod)
......@@ -626,7 +633,7 @@ void darshan_core_shutdown()
free(mod_buf);
if(internal_timing_flag)
mod2[i] = darshan_core_wtime();
mod2[i] = darshan_core_wtime_absolute();
/* error out if unable to write module data */
DARSHAN_CHECK_ERR(ret, "unable to write %s module data to log file %s",
......@@ -634,10 +641,10 @@ void darshan_core_shutdown()
}
if(internal_timing_flag)
header1 = darshan_core_wtime();
header1 = darshan_core_wtime_absolute();
ret = darshan_log_write_header(log_fh, final_core);
if(internal_timing_flag)
header2 = darshan_core_wtime();
header2 = darshan_core_wtime_absolute();
DARSHAN_CHECK_ERR(ret, "unable to write header to file %s", logfile_name);
/* done writing data, close the log file */
......@@ -655,7 +662,7 @@ void darshan_core_shutdown()
double mod_tm[DARSHAN_MAX_MODS];
double all_tm;
tm_end = darshan_core_wtime();
tm_end = darshan_core_wtime_absolute();
open_tm = open2 - open1;
header_tm = header2 - header1;
......
......@@ -1796,6 +1796,14 @@ int DARSHAN_DECL(rename)(const char *oldpath, const char *newpath)
char *oldpath_clean, *newpath_clean;
darshan_record_id old_rec_id, new_rec_id;
struct posix_file_record_ref *old_rec_ref, *new_rec_ref;
int disabled = 0;
/* This is a special case to avoid attempting to instrument final rename
* performed by darshan itself when finalizing
*/
POSIX_LOCK();
disabled = darshan_core_disabled_instrumentation();
POSIX_UNLOCK();
MAP_OR_FAIL(rename);
......@@ -1803,6 +1811,9 @@ int DARSHAN_DECL(rename)(const char *oldpath, const char *newpath)
ret = __real_rename(oldpath, newpath);
tm2 = darshan_core_wtime();
if(disabled)
return(ret);
if(ret == 0)
{
oldpath_clean = darshan_clean_file_path(oldpath);
......
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