[Darshan-commits] [Git][darshan/darshan][master] 3 commits: avoid attempting to instrument final log rename()

Philip Carns xgitlab at cels.anl.gov
Wed Mar 24 15:57:46 CDT 2021



Philip Carns pushed to branch master at darshan / darshan


Commits:
e62a6255 by Phil Carns at 2021-03-24T16:33:07-04:00
avoid attempting to instrument final log rename()

- - - - -
d26bf896 by Phil Carns at 2021-03-24T16:55:23-04:00
bug fix to internal shutdown timing

- - - - -
755e6853 by Philip Carns at 2021-03-24T15:57:42-05:00
Merge branch 'carns/issue-312-log-time-name' into 'master'

fix internal timing for finalize

Closes #312

See merge request darshan/darshan!90
- - - - -


2 changed files:

- darshan-runtime/lib/darshan-core.c
- darshan-runtime/lib/darshan-posix.c


Changes:

=====================================
darshan-runtime/lib/darshan-core.c
=====================================
@@ -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;


=====================================
darshan-runtime/lib/darshan-posix.c
=====================================
@@ -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);



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/e245da9d371d38def7625f7b9a1c53d8afa91f45...755e68535b3129179bdf312c8351dd4b9b6a3e40

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/e245da9d371d38def7625f7b9a1c53d8afa91f45...755e68535b3129179bdf312c8351dd4b9b6a3e40
You're receiving this email because of your account on xgitlab.cels.anl.gov.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20210324/bebb7e5b/attachment-0001.html>


More information about the Darshan-commits mailing list