[Darshan-commits] [Git][darshan/darshan][dev-modular] 3 commits: rework header org. for module-specific versions

Shane Snyder xgitlab at cels.anl.gov
Wed Nov 25 12:42:19 CST 2015


Shane Snyder pushed to branch dev-modular at darshan / darshan


Commits:
ba451e9a by Shane Snyder at 2015-11-24T22:40:51Z
rework header org. for module-specific versions

- - - - -
66181457 by Shane Snyder at 2015-11-25T10:18:12Z
modify runtime code to store each module's version

- - - - -
173d38b8 by Shane Snyder at 2015-11-25T12:41:33Z
update util interfaces to support mod-specific ver

- - - - -


31 changed files:

- darshan-bgq-log-format.h
- darshan-hdf5-log-format.h
- darshan-log-format.h
- darshan-mpiio-log-format.h
- darshan-null-log-format.h
- darshan-pnetcdf-log-format.h
- darshan-posix-log-format.h
- darshan-runtime/lib/darshan-bgq.c
- darshan-runtime/lib/darshan-core.c
- darshan-runtime/lib/darshan-hdf5.c
- darshan-runtime/lib/darshan-mpiio.c
- darshan-runtime/lib/darshan-null.c
- darshan-runtime/lib/darshan-pnetcdf.c
- darshan-runtime/lib/darshan-posix.c
- darshan-util/Makefile.in
- darshan-util/darshan-bgq-logutils.c
- darshan-util/darshan-bgq-logutils.h
- darshan-util/darshan-convert.c
- darshan-util/darshan-hdf5-logutils.c
- darshan-util/darshan-hdf5-logutils.h
- darshan-util/darshan-logutils.c
- darshan-util/darshan-logutils.h
- darshan-util/darshan-mpiio-logutils.c
- darshan-util/darshan-mpiio-logutils.h
- darshan-util/darshan-null-logutils.c
- darshan-util/darshan-null-logutils.h
- darshan-util/darshan-parser.c
- darshan-util/darshan-pnetcdf-logutils.c
- darshan-util/darshan-pnetcdf-logutils.h
- darshan-util/darshan-posix-logutils.c
- darshan-util/darshan-posix-logutils.h


Changes:

=====================================
darshan-bgq-log-format.h
=====================================
--- a/darshan-bgq-log-format.h
+++ b/darshan-bgq-log-format.h
@@ -7,8 +7,8 @@
 #ifndef __DARSHAN_BGQ_LOG_FORMAT_H
 #define __DARSHAN_BGQ_LOG_FORMAT_H
 
-#include "darshan-log-format.h"
-
+/* current BGQ log format version */
+#define DARSHAN_BGQ_VER 1
 
 #define BGQ_COUNTERS \
     X(BGQ_CSJOBID, "control system jobid") \


=====================================
darshan-hdf5-log-format.h
=====================================
--- a/darshan-hdf5-log-format.h
+++ b/darshan-hdf5-log-format.h
@@ -7,7 +7,8 @@
 #ifndef __DARSHAN_HDF5_LOG_FORMAT_H
 #define __DARSHAN_HDF5_LOG_FORMAT_H
 
-#include "darshan-log-format.h"
+/* current HDF5 log format version */
+#define DARSHAN_HDF5_VER 1
 
 #define HDF5_COUNTERS \
     /* count of HDF5 opens */\


=====================================
darshan-log-format.h
=====================================
--- a/darshan-log-format.h
+++ b/darshan-log-format.h
@@ -31,44 +31,9 @@
 /* max length of exe string within job record (not counting '\0') */
 #define DARSHAN_EXE_LEN (DARSHAN_JOB_RECORD_SIZE - sizeof(struct darshan_job) - 1)
 
+/* max number of modules that can be used in a darshan log */
 #define DARSHAN_MAX_MODS 16
 
-/* X-macro for keeping module ordering consistent */
-/* NOTE: first val used to define module enum values, 
- * second val used to define module name strings, and
- * third val is used to provide the name of a 
- * corresponding logutils structure for parsing module
- * data out of the log file (only used in darshan-util
- * component -- NULL can be passed if there are no
- * logutil definitions)
- */
-#define DARSHAN_MODULE_IDS \
-    X(DARSHAN_NULL_MOD, "NULL", NULL) \
-    X(DARSHAN_POSIX_MOD, "POSIX", &posix_logutils) \
-    X(DARSHAN_MPIIO_MOD, "MPI-IO", &mpiio_logutils) \
-    X(DARSHAN_HDF5_MOD, "HDF5", &hdf5_logutils) \
-    X(DARSHAN_PNETCDF_MOD, "PNETCDF", &pnetcdf_logutils) \
-    X(DARSHAN_BGQ_MOD, "BG/Q", &bgq_logutils)
-
-/* unique identifiers to distinguish between available darshan modules */
-/* NOTES: - valid ids range from [0...DARSHAN_MAX_MODS-1]
- *        - order of ids control module shutdown order (and consequently, order in log file)
- */
-#define X(a, b, c) a,
-typedef enum
-{
-    DARSHAN_MODULE_IDS
-} darshan_module_id;
-#undef X
-
-/* module name strings */
-#define X(a, b, c) b,
-static char * const darshan_module_names[] =
-{
-    DARSHAN_MODULE_IDS
-};
-#undef X
-
 /* simple macros for accessing module flag bitfields */
 #define DARSHAN_MOD_FLAG_SET(flags, id) flags = (flags | (1 << id))
 #define DARSHAN_MOD_FLAG_UNSET(flags, id) flags = (flags & ~(1 << id))
@@ -105,6 +70,7 @@ struct darshan_header
     uint32_t partial_flag;
     struct darshan_log_map rec_map;
     struct darshan_log_map mod_map[DARSHAN_MAX_MODS];
+    uint32_t mod_ver[DARSHAN_MAX_MODS];
 };
 
 /* job-level metadata stored for this application */
@@ -126,4 +92,61 @@ struct darshan_record
     darshan_record_id id;
 };
 
+
+/************************************************
+ *** module-specific includes and definitions ***
+ ************************************************/
+
+#include "darshan-null-log-format.h"
+#include "darshan-posix-log-format.h"
+#include "darshan-mpiio-log-format.h"
+#include "darshan-hdf5-log-format.h"
+#include "darshan-pnetcdf-log-format.h"
+#include "darshan-bgq-log-format.h"
+
+/* X-macro for keeping module ordering consistent */
+/* NOTE: first val used to define module enum values, 
+ * second val used to define module name strings,
+ * third val is the log format version for the module,
+ * and fourth val is used to provide the name of a 
+ * corresponding logutils structure for parsing module
+ * data out of the log file (only used in darshan-util
+ * component -- NULL can be passed if there are no
+ * logutil definitions)
+ */
+#define DARSHAN_MODULE_IDS \
+    X(DARSHAN_NULL_MOD,     "NULL",     DARSHAN_NULL_VER,       NULL) \
+    X(DARSHAN_POSIX_MOD,    "POSIX",    DARSHAN_POSIX_VER,      &posix_logutils) \
+    X(DARSHAN_MPIIO_MOD,    "MPI-IO",   DARSHAN_MPIIO_VER,      &mpiio_logutils) \
+    X(DARSHAN_HDF5_MOD,     "HDF5",     DARSHAN_HDF5_VER,       &hdf5_logutils) \
+    X(DARSHAN_PNETCDF_MOD,  "PNETCDF",  DARSHAN_PNETCDF_VER,    &pnetcdf_logutils) \
+    X(DARSHAN_BGQ_MOD,      "BG/Q",     DARSHAN_BGQ_VER,        &bgq_logutils)
+
+/* unique identifiers to distinguish between available darshan modules */
+/* NOTES: - valid ids range from [0...DARSHAN_MAX_MODS-1]
+ *        - order of ids control module shutdown order (and consequently, order in log file)
+ */
+#define X(a, b, c, d) a,
+typedef enum
+{
+    DARSHAN_MODULE_IDS
+} darshan_module_id;
+#undef X
+
+/* module name strings */
+#define X(a, b, c, d) b,
+static char * const darshan_module_names[] =
+{
+    DARSHAN_MODULE_IDS
+};
+#undef X
+
+/* module version numbers */
+#define X(a, b, c, d) c,
+static const int darshan_module_versions[] =
+{
+    DARSHAN_MODULE_IDS
+};
+#undef X
+
 #endif /* __DARSHAN_LOG_FORMAT_H */


=====================================
darshan-mpiio-log-format.h
=====================================
--- a/darshan-mpiio-log-format.h
+++ b/darshan-mpiio-log-format.h
@@ -7,7 +7,8 @@
 #ifndef __DARSHAN_MPIIO_LOG_FORMAT_H
 #define __DARSHAN_MPIIO_LOG_FORMAT_H
 
-#include "darshan-log-format.h"
+/* current MPI-IO log format version */
+#define DARSHAN_MPIIO_VER 1
 
 /* TODO: maybe use a counter to track cases in which a derived datatype is used? */
 


=====================================
darshan-null-log-format.h
=====================================
--- a/darshan-null-log-format.h
+++ b/darshan-null-log-format.h
@@ -7,7 +7,8 @@
 #ifndef __DARSHAN_NULL_LOG_FORMAT_H
 #define __DARSHAN_NULL_LOG_FORMAT_H
 
-#include "darshan-log-format.h"
+/* current log format version, to support backwards compatibility */
+#define DARSHAN_NULL_VER 1
 
 #define NULL_COUNTERS \
     /* count of number of 'bar' function calls */\


=====================================
darshan-pnetcdf-log-format.h
=====================================
--- a/darshan-pnetcdf-log-format.h
+++ b/darshan-pnetcdf-log-format.h
@@ -7,7 +7,8 @@
 #ifndef __DARSHAN_PNETCDF_LOG_FORMAT_H
 #define __DARSHAN_PNETCDF_LOG_FORMAT_H
 
-#include "darshan-log-format.h"
+/* current PNETCDF log format version */
+#define DARSHAN_PNETCDF_VER 1
 
 #define PNETCDF_COUNTERS \
     /* count of PNETCDF independent opens */\


=====================================
darshan-posix-log-format.h
=====================================
--- a/darshan-posix-log-format.h
+++ b/darshan-posix-log-format.h
@@ -6,7 +6,8 @@
 #ifndef __DARSHAN_POSIX_LOG_FORMAT_H
 #define __DARSHAN_POSIX_LOG_FORMAT_H
 
-#include "darshan-log-format.h"
+/* current POSIX log format version */
+#define DARSHAN_POSIX_VER 1
 
 #define POSIX_COUNTERS \
     /* count of posix opens */\


=====================================
darshan-runtime/lib/darshan-bgq.c
=====================================
--- a/darshan-runtime/lib/darshan-bgq.c
+++ b/darshan-runtime/lib/darshan-bgq.c
@@ -16,7 +16,6 @@
 
 #include "uthash.h"
 #include "darshan.h"
-#include "darshan-bgq-log-format.h"
 #include "darshan-dynamic.h"
 
 #include <mpix.h>


=====================================
darshan-runtime/lib/darshan-core.c
=====================================
--- a/darshan-runtime/lib/darshan-core.c
+++ b/darshan-runtime/lib/darshan-core.c
@@ -264,7 +264,6 @@ void darshan_core_shutdown()
     double header1, header2;
     double tm_end;
     uint64_t gz_fp = 0;
-    uint32_t tmp_partial_flag;
     MPI_File log_fh;
     MPI_Status status;
 
@@ -389,7 +388,6 @@ void darshan_core_shutdown()
         {
             fprintf(stderr, "darshan library warning: unable to open log file %s\n",
                 logfile_name);
-            unlink(logfile_name);
         }
         free(logfile_name);
         darshan_core_cleanup(final_core);
@@ -555,23 +553,28 @@ void darshan_core_shutdown()
             mod2[i] = DARSHAN_MPI_CALL(PMPI_Wtime)();
     }
 
-    /* run a reduction to determine if any application processes had to set the
-     * partial flag for any modules. this happens when a module exhausts its memory
-     * and does not track every possible record
-     */
-    DARSHAN_MPI_CALL(PMPI_Reduce)(&(final_core->log_header.partial_flag),
-        &tmp_partial_flag, 1, MPI_UINT32_T, MPI_BOR, 0, MPI_COMM_WORLD);
-
     if(internal_timing_flag)
         header1 = DARSHAN_MPI_CALL(PMPI_Wtime)();
-    /* rank 0 is responsible for writing the log header */
+    /* write out log header, after running 2 reduction on header variables:
+     *  1) reduce 'partial_flag' variable to determine which modules ran out
+     *     of memory for storing I/O data
+     *  2) reduce 'mod_ver' array to determine which log format version each
+     *     module used for this output log
+     */
     if(my_rank == 0)
     {
+        DARSHAN_MPI_CALL(PMPI_Reduce)(MPI_IN_PLACE,
+            &(final_core->log_header.partial_flag), 1, MPI_UINT32_T,
+            MPI_BOR, 0, MPI_COMM_WORLD);
+        DARSHAN_MPI_CALL(PMPI_Reduce)(MPI_IN_PLACE,
+            final_core->log_header.mod_ver, DARSHAN_MAX_MODS, MPI_UINT32_T,
+            MPI_MAX, 0, MPI_COMM_WORLD);
+
+        /* rank 0 is responsible for writing the log header */
         /* initialize the remaining header fields */
         strcpy(final_core->log_header.version_string, DARSHAN_LOG_VERSION);
         final_core->log_header.magic_nr = DARSHAN_MAGIC_NR;
         final_core->log_header.comp_type = DARSHAN_ZLIB_COMP;
-        final_core->log_header.partial_flag = tmp_partial_flag;
 
         all_ret = DARSHAN_MPI_CALL(PMPI_File_write_at)(log_fh, 0, &(final_core->log_header),
             sizeof(struct darshan_header), MPI_BYTE, &status);
@@ -582,6 +585,15 @@ void darshan_core_shutdown()
             unlink(logfile_name);
         }
     }
+    else
+    {
+        DARSHAN_MPI_CALL(PMPI_Reduce)(&(final_core->log_header.partial_flag),
+            &(final_core->log_header.partial_flag), 1, MPI_UINT32_T,
+            MPI_BOR, 0, MPI_COMM_WORLD);
+        DARSHAN_MPI_CALL(PMPI_Reduce)(final_core->log_header.mod_ver,
+            final_core->log_header.mod_ver, DARSHAN_MAX_MODS, MPI_UINT32_T,
+            MPI_MAX, 0, MPI_COMM_WORLD);
+    }
 
     /* error out if unable to write log header */
     DARSHAN_MPI_CALL(PMPI_Bcast)(&all_ret, 1, MPI_INT, 0, MPI_COMM_WORLD);
@@ -1532,6 +1544,7 @@ void darshan_core_register_module(
 
     /* register module with darshan */
     darshan_core->mod_array[mod_id] = mod;
+    darshan_core->log_header.mod_ver[mod_id] = darshan_module_versions[mod_id];
 
     /* get the calling process's rank */
     DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, my_rank);


=====================================
darshan-runtime/lib/darshan-hdf5.c
=====================================
--- a/darshan-runtime/lib/darshan-hdf5.c
+++ b/darshan-runtime/lib/darshan-hdf5.c
@@ -22,7 +22,6 @@
 #include "uthash.h"
 
 #include "darshan.h"
-#include "darshan-hdf5-log-format.h"
 #include "darshan-dynamic.h"
 
 /* hope this doesn't change any time soon */


=====================================
darshan-runtime/lib/darshan-mpiio.c
=====================================
--- a/darshan-runtime/lib/darshan-mpiio.c
+++ b/darshan-runtime/lib/darshan-mpiio.c
@@ -23,7 +23,6 @@
 #include "uthash.h"
 
 #include "darshan.h"
-#include "darshan-mpiio-log-format.h"
 #include "darshan-dynamic.h"
 
 /* The mpiio_file_runtime structure maintains necessary runtime metadata


=====================================
darshan-runtime/lib/darshan-null.c
=====================================
--- a/darshan-runtime/lib/darshan-null.c
+++ b/darshan-runtime/lib/darshan-null.c
@@ -16,7 +16,6 @@
 
 #include "uthash.h"
 #include "darshan.h"
-#include "darshan-null-log-format.h"
 
 /* The "NULL" module is an example instrumentation module implementation provided
  * with Darshan, primarily to indicate how arbitrary modules may be integrated


=====================================
darshan-runtime/lib/darshan-pnetcdf.c
=====================================
--- a/darshan-runtime/lib/darshan-pnetcdf.c
+++ b/darshan-runtime/lib/darshan-pnetcdf.c
@@ -22,7 +22,6 @@
 #include "uthash.h"
 
 #include "darshan.h"
-#include "darshan-pnetcdf-log-format.h"
 #include "darshan-dynamic.h"
 
 DARSHAN_FORWARD_DECL(ncmpi_create, int, (MPI_Comm comm, const char *path, int cmode, MPI_Info info, int *ncidp));


=====================================
darshan-runtime/lib/darshan-posix.c
=====================================
--- a/darshan-runtime/lib/darshan-posix.c
+++ b/darshan-runtime/lib/darshan-posix.c
@@ -30,7 +30,6 @@
 #include "utlist.h"
 
 #include "darshan.h"
-#include "darshan-posix-log-format.h"
 #include "darshan-dynamic.h"
 
 #ifndef HAVE_OFF64_T


=====================================
darshan-util/Makefile.in
=====================================
--- a/darshan-util/Makefile.in
+++ b/darshan-util/Makefile.in
@@ -93,10 +93,10 @@ lookup3.o: lookup3.c
 	$(CC) $(CFLAGS) -c $< -o $@
 
 darshan-analyzer: darshan-analyzer.c darshan-logutils.h $(DARSHAN_LOG_FORMAT) $(DARSHAN_MOD_LOGUTIL_HEADERS) $(DARSHAN_MOD_LOG_FORMATS) libdarshan-util.a | uthash-1.9.2
-	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) $< libdarshan-util.a -o $@ $(LIBS)
 
 darshan-convert: darshan-convert.c darshan-logutils.h $(DARSHAN_LOG_FORMAT) libdarshan-util.a lookup3.o | uthash-1.9.2
-	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) $< lookup3.o libdarshan-util.a -o $@ $(LIBS)
 
 #darshan-diff: darshan-diff.o $(DARSHAN_LOG_FORMAT) darshan-logutils.o darshan-logutils.h
 #	$(CC) $(CFLAGS)  $(LDFLAGS) $< darshan-logutils.o -o $@ $(LIBS)
@@ -104,7 +104,7 @@ darshan-convert: darshan-convert.c darshan-logutils.h $(DARSHAN_LOG_FORMAT) libd
 #	$(CC) $(CFLAGS) -c  $< -o $@
 
 darshan-parser: darshan-parser.c darshan-logutils.h $(DARSHAN_LOG_FORMAT) $(DARSHAN_MOD_LOGUTIL_HEADERS) $(DARSHAN_MOD_LOG_FORMATS) libdarshan-util.a | uthash-1.9.2
-	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS) 
+	$(CC) $(CFLAGS) $(LDFLAGS) $< libdarshan-util.a -o $@ $(LIBS) 
 
 #test/gztest: test/gztest.c mktestdir
 #	$(CC) $(CFLAGS)  $(LDFLAGS) -lz $< -o $@


=====================================
darshan-util/darshan-bgq-logutils.c
=====================================
--- a/darshan-util/darshan-bgq-logutils.c
+++ b/darshan-util/darshan-bgq-logutils.c
@@ -17,7 +17,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "darshan-bgq-logutils.h"
+#include "darshan-logutils.h"
 
 /* counter name strings for the POSIX module */
 #define X(a, b) #a,
@@ -32,9 +32,9 @@ char *bgq_f_counter_names[] = {
 
 static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf,
     darshan_record_id* rec_id);
-static int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf);
+static int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf, int ver);
 static void darshan_log_print_bgq_rec(void *file_rec,
-    char *file_name, char *mnt_pt, char *fs_type);
+    char *file_name, char *mnt_pt, char *fs_type, int ver);
 
 struct darshan_mod_logutil_funcs bgq_logutils =
 {
@@ -75,13 +75,13 @@ static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf,
     }
 }
 
-static int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf)
+static int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf, int ver)
 {
     struct darshan_bgq_record *rec = (struct darshan_bgq_record *)bgq_buf;
     int ret;
 
     ret = darshan_log_putmod(fd, DARSHAN_BGQ_MOD, rec,
-        sizeof(struct darshan_bgq_record));
+        sizeof(struct darshan_bgq_record), ver);
     if(ret < 0)
         return(-1);
 
@@ -89,7 +89,7 @@ static int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf)
 }
 
 static void darshan_log_print_bgq_rec(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type)
+    char *mnt_pt, char *fs_type, int ver)
 {
     int i;
     struct darshan_bgq_record *bgq_file_rec =


=====================================
darshan-util/darshan-bgq-logutils.h
=====================================
--- a/darshan-util/darshan-bgq-logutils.h
+++ b/darshan-util/darshan-bgq-logutils.h
@@ -7,9 +7,6 @@
 #ifndef __DARSHAN_BGQ_LOG_UTILS_H
 #define __DARSHAN_BGQ_LOG_UTILS_H
 
-#include "darshan-logutils.h"
-#include "darshan-bgq-log-format.h"
-
 extern char *bgq_counter_names[];
 extern char *bgq_f_counter_names[];
 


=====================================
darshan-util/darshan-convert.c
=====================================
--- a/darshan-util/darshan-convert.c
+++ b/darshan-util/darshan-convert.c
@@ -373,7 +373,7 @@ int main(int argc, char **argv)
         {
             if(!hash || hash == rec_id)
             {
-                ret = mod_logutils[i]->log_put_record(outfile, mod_buf);
+                ret = mod_logutils[i]->log_put_record(outfile, mod_buf, infile->mod_ver[i]);
                 if(ret < 0)
                 {
                     darshan_log_close(infile);


=====================================
darshan-util/darshan-hdf5-logutils.c
=====================================
--- a/darshan-util/darshan-hdf5-logutils.c
+++ b/darshan-util/darshan-hdf5-logutils.c
@@ -17,7 +17,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "darshan-hdf5-logutils.h"
+#include "darshan-logutils.h"
 
 /* counter name strings for the HDF5 module */
 #define X(a) #a,
@@ -32,9 +32,9 @@ char *hdf5_f_counter_names[] = {
 
 static int darshan_log_get_hdf5_file(darshan_fd fd, void* hdf5_buf,
     darshan_record_id* rec_id);
-static int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf);
+static int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf, int ver);
 static void darshan_log_print_hdf5_file(void *file_rec,
-    char *file_name, char *mnt_pt, char *fs_type);
+    char *file_name, char *mnt_pt, char *fs_type, int ver);
 
 struct darshan_mod_logutil_funcs hdf5_logutils =
 {
@@ -75,13 +75,13 @@ static int darshan_log_get_hdf5_file(darshan_fd fd, void* hdf5_buf,
     }
 }
 
-static int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf)
+static int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf, int ver)
 {
     struct darshan_hdf5_file *file = (struct darshan_hdf5_file *)hdf5_buf;
     int ret;
 
     ret = darshan_log_putmod(fd, DARSHAN_HDF5_MOD, file,
-        sizeof(struct darshan_hdf5_file));
+        sizeof(struct darshan_hdf5_file), ver);
     if(ret < 0)
         return(-1);
 
@@ -89,7 +89,7 @@ static int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf)
 }
 
 static void darshan_log_print_hdf5_file(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type)
+    char *mnt_pt, char *fs_type, int ver)
 {
     int i;
     struct darshan_hdf5_file *hdf5_file_rec =


=====================================
darshan-util/darshan-hdf5-logutils.h
=====================================
--- a/darshan-util/darshan-hdf5-logutils.h
+++ b/darshan-util/darshan-hdf5-logutils.h
@@ -7,9 +7,6 @@
 #ifndef __DARSHAN_HDF5_LOG_UTILS_H
 #define __DARSHAN_HDF5_LOG_UTILS_H
 
-#include "darshan-logutils.h"
-#include "darshan-hdf5-log-format.h"
-
 extern char *hdf5_counter_names[];
 extern char *hdf5_f_counter_names[];
 


=====================================
darshan-util/darshan-logutils.c
=====================================
--- a/darshan-util/darshan-logutils.c
+++ b/darshan-util/darshan-logutils.c
@@ -87,7 +87,7 @@ static int darshan_log_dzload(darshan_fd fd, struct darshan_log_map map);
 static int darshan_log_dzunload(darshan_fd fd, struct darshan_log_map *map_p);
 
 /* each module's implementation of the darshan logutil functions */
-#define X(a, b, c) c,
+#define X(a, b, c, d) d,
 struct darshan_mod_logutil_funcs *mod_logutils[DARSHAN_MAX_MODS] =
 {
     DARSHAN_MODULE_IDS
@@ -730,7 +730,7 @@ int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
  * returns number of bytes written on success, -1 on failure
  */
 int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
-    void *mod_buf, int mod_buf_sz)
+    void *mod_buf, int mod_buf_sz, int ver)
 {
     struct darshan_fd_int_state *state = fd->state;
     int ret;
@@ -755,6 +755,9 @@ int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
         return(-1);
     }
 
+    /* set the version number for this module's data */
+    fd->mod_ver[mod_id] = ver;
+
     return(0);
 }
 
@@ -883,8 +886,10 @@ static int darshan_log_getheader(darshan_fd fd)
         }
     }
 
+    /* set some fd fields based on what's stored in the header */
     state->comp_type = header.comp_type;
     fd->partial_flag = header.partial_flag;
+    memcpy(fd->mod_ver, header.mod_ver, DARSHAN_MAX_MODS * sizeof(uint32_t));
 
     /* save the mapping of data within log file to this file descriptor */
     fd->job_map.off = sizeof(struct darshan_header);


=====================================
darshan-util/darshan-logutils.h
=====================================
--- a/darshan-util/darshan-logutils.h
+++ b/darshan-util/darshan-logutils.h
@@ -33,6 +33,8 @@ struct darshan_fd_s
     struct darshan_log_map job_map;
     struct darshan_log_map rec_map;
     struct darshan_log_map mod_map[DARSHAN_MAX_MODS];
+    /* module-specific log-format versions contained in log */
+    uint32_t mod_ver[DARSHAN_MAX_MODS];
 
     /* KEEP OUT -- remaining state hidden in logutils source */
     struct darshan_fd_int_state *state;
@@ -64,14 +66,16 @@ struct darshan_mod_logutil_funcs
      */
     int (*log_put_record)(
         darshan_fd fd,
-        void *buf
+        void *buf,
+        int ver
     );
     /* print the counters for a given log file record */
     void (*log_print_record)(
         void *file_rec,
         char *file_name,
         char *mnt_pt,
-        char *fs_type
+        char *fs_type,
+        int ver
     );
 };
 
@@ -99,7 +103,7 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash);
 int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
     void *mod_buf, int mod_buf_sz);
 int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
-    void *mod_buf, int mod_buf_sz);
+    void *mod_buf, int mod_buf_sz, int ver);
 void darshan_log_close(darshan_fd file);
 
 /* convenience macros for printing Darshan counters */


=====================================
darshan-util/darshan-mpiio-logutils.c
=====================================
--- a/darshan-util/darshan-mpiio-logutils.c
+++ b/darshan-util/darshan-mpiio-logutils.c
@@ -17,7 +17,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "darshan-mpiio-logutils.h"
+#include "darshan-logutils.h"
 
 /* counter name strings for the MPI-IO module */
 #define X(a) #a,
@@ -32,9 +32,9 @@ char *mpiio_f_counter_names[] = {
 
 static int darshan_log_get_mpiio_file(darshan_fd fd, void* mpiio_buf,
     darshan_record_id* rec_id);
-static int darshan_log_put_mpiio_file(darshan_fd fd, void* mpiio_buf);
+static int darshan_log_put_mpiio_file(darshan_fd fd, void* mpiio_buf, int ver);
 static void darshan_log_print_mpiio_file(void *file_rec,
-    char *file_name, char *mnt_pt, char *fs_type);
+    char *file_name, char *mnt_pt, char *fs_type, int ver);
 
 struct darshan_mod_logutil_funcs mpiio_logutils =
 {
@@ -75,13 +75,13 @@ static int darshan_log_get_mpiio_file(darshan_fd fd, void* mpiio_buf,
     }
 }
 
-static int darshan_log_put_mpiio_file(darshan_fd fd, void* mpiio_buf)
+static int darshan_log_put_mpiio_file(darshan_fd fd, void* mpiio_buf, int ver)
 {
     struct darshan_mpiio_file *file = (struct darshan_mpiio_file *)mpiio_buf;
     int ret;
 
     ret = darshan_log_putmod(fd, DARSHAN_MPIIO_MOD, file,
-        sizeof(struct darshan_mpiio_file));
+        sizeof(struct darshan_mpiio_file), ver);
     if(ret < 0)
         return(-1);
 
@@ -89,7 +89,7 @@ static int darshan_log_put_mpiio_file(darshan_fd fd, void* mpiio_buf)
 }
 
 static void darshan_log_print_mpiio_file(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type)
+    char *mnt_pt, char *fs_type, int ver)
 {
     int i;
     struct darshan_mpiio_file *mpiio_file_rec =


=====================================
darshan-util/darshan-mpiio-logutils.h
=====================================
--- a/darshan-util/darshan-mpiio-logutils.h
+++ b/darshan-util/darshan-mpiio-logutils.h
@@ -7,9 +7,6 @@
 #ifndef __DARSHAN_MPIIO_LOG_UTILS_H
 #define __DARSHAN_MPIIO_LOG_UTILS_H
 
-#include "darshan-logutils.h"
-#include "darshan-mpiio-log-format.h"
-
 extern char *mpiio_counter_names[];
 extern char *mpiio_f_counter_names[];
 


=====================================
darshan-util/darshan-null-logutils.c
=====================================
--- a/darshan-util/darshan-null-logutils.c
+++ b/darshan-util/darshan-null-logutils.c
@@ -17,7 +17,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "darshan-null-logutils.h"
+#include "darshan-logutils.h"
 
 /* integer counter name strings for the NULL module */
 #define X(a) #a,
@@ -34,9 +34,9 @@ char *null_f_counter_names[] = {
 /* prototypes for each of the NULL module's logutil functions */
 static int darshan_log_get_null_record(darshan_fd fd, void* null_buf,
     darshan_record_id* rec_id);
-static int darshan_log_put_null_record(darshan_fd fd, void* null_buf);
+static int darshan_log_put_null_record(darshan_fd fd, void* null_buf, int ver);
 static void darshan_log_print_null_record(void *file_rec,
-    char *file_name, char *mnt_pt, char *fs_type);
+    char *file_name, char *mnt_pt, char *fs_type, int ver);
 
 /* structure storing each function needed for implementing the darshan
  * logutil interface. these functions are used for reading, writing, and
@@ -91,14 +91,14 @@ static int darshan_log_get_null_record(darshan_fd fd, void* null_buf,
 /* write the NULL record stored in 'null_buf' to log file descriptor 'fd'.
  * Return 0 on success, -1 on failure
  */
-static int darshan_log_put_null_record(darshan_fd fd, void* null_buf)
+static int darshan_log_put_null_record(darshan_fd fd, void* null_buf, int ver)
 {
     struct darshan_null_record *rec = (struct darshan_null_record *)null_buf;
     int ret;
 
     /* append NULL record to darshan log file */
     ret = darshan_log_putmod(fd, DARSHAN_NULL_MOD, rec,
-        sizeof(struct darshan_null_record));
+        sizeof(struct darshan_null_record), ver);
     if(ret < 0)
         return(-1);
 
@@ -107,7 +107,7 @@ static int darshan_log_put_null_record(darshan_fd fd, void* null_buf)
 
 /* print all I/O data record statistics for the given NULL record */
 static void darshan_log_print_null_record(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type)
+    char *mnt_pt, char *fs_type, int ver)
 {
     int i;
     struct darshan_null_record *null_rec =


=====================================
darshan-util/darshan-null-logutils.h
=====================================
--- a/darshan-util/darshan-null-logutils.h
+++ b/darshan-util/darshan-null-logutils.h
@@ -7,9 +7,6 @@
 #ifndef __DARSHAN_NULL_LOG_UTILS_H
 #define __DARSHAN_NULL_LOG_UTILS_H
 
-#include "darshan-logutils.h"
-#include "darshan-null-log-format.h"
-
 /* declare NULL module counter name strings and logutil definition as
  * extern variables so they can be used in other utilities
  */


=====================================
darshan-util/darshan-parser.c
=====================================
--- a/darshan-util/darshan-parser.c
+++ b/darshan-util/darshan-parser.c
@@ -299,17 +299,17 @@ int main(int argc, char **argv)
     }
 
     /* print breakdown of each log file region's contribution to file size */
-    printf("\n# log file region sizes (compressed)\n");
+    printf("\n# log file regions\n");
     printf("# -------------------------------------------------------\n");
     printf("# header: %zu bytes (uncompressed)\n", sizeof(struct darshan_header));
-    printf("# job data: %zu bytes\n", fd->job_map.len);
-    printf("# record table: %zu bytes\n", fd->rec_map.len);
+    printf("# job data: %zu bytes (compressed)\n", fd->job_map.len);
+    printf("# record table: %zu bytes (compressed)\n", fd->rec_map.len);
     for(i=0; i<DARSHAN_MAX_MODS; i++)
     {
         if(fd->mod_map[i].len)
         {
-            printf("# %s module: %zu bytes\n", darshan_module_names[i],
-                fd->mod_map[i].len);
+            printf("# %s module: %zu bytes (compressed), ver=%d\n",
+                darshan_module_names[i], fd->mod_map[i].len, fd->mod_ver[i]);
         }
     }
 
@@ -417,7 +417,7 @@ int main(int argc, char **argv)
             {
                 /* print the corresponding module data for this record */
                 mod_logutils[i]->log_print_record(mod_buf, ref->rec.name,
-                    mnt_pt, fs_type);
+                    mnt_pt, fs_type, fd->mod_ver[i]);
             }
 
             /* we calculate more detailed stats for POSIX and MPI-IO modules, 


=====================================
darshan-util/darshan-pnetcdf-logutils.c
=====================================
--- a/darshan-util/darshan-pnetcdf-logutils.c
+++ b/darshan-util/darshan-pnetcdf-logutils.c
@@ -17,7 +17,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "darshan-pnetcdf-logutils.h"
+#include "darshan-logutils.h"
 
 /* counter name strings for the PNETCDF module */
 #define X(a) #a,
@@ -32,9 +32,9 @@ char *pnetcdf_f_counter_names[] = {
 
 static int darshan_log_get_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf,
     darshan_record_id* rec_id);
-static int darshan_log_put_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf);
+static int darshan_log_put_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf, int ver);
 static void darshan_log_print_pnetcdf_file(void *file_rec,
-    char *file_name, char *mnt_pt, char *fs_type);
+    char *file_name, char *mnt_pt, char *fs_type, int ver);
 
 struct darshan_mod_logutil_funcs pnetcdf_logutils =
 {
@@ -75,13 +75,13 @@ static int darshan_log_get_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf,
     }
 }
 
-static int darshan_log_put_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf)
+static int darshan_log_put_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf, int ver)
 {
     struct darshan_pnetcdf_file *file = (struct darshan_pnetcdf_file *)pnetcdf_buf;
     int ret;
 
     ret = darshan_log_putmod(fd, DARSHAN_PNETCDF_MOD, file,
-        sizeof(struct darshan_pnetcdf_file));
+        sizeof(struct darshan_pnetcdf_file), ver);
     if(ret < 0)
         return(-1);
 
@@ -89,7 +89,7 @@ static int darshan_log_put_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf)
 }
 
 static void darshan_log_print_pnetcdf_file(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type)
+    char *mnt_pt, char *fs_type, int ver)
 {
     int i;
     struct darshan_pnetcdf_file *pnetcdf_file_rec =


=====================================
darshan-util/darshan-pnetcdf-logutils.h
=====================================
--- a/darshan-util/darshan-pnetcdf-logutils.h
+++ b/darshan-util/darshan-pnetcdf-logutils.h
@@ -7,9 +7,6 @@
 #ifndef __DARSHAN_PNETCDF_LOG_UTILS_H
 #define __DARSHAN_PNETCDF_LOG_UTILS_H
 
-#include "darshan-logutils.h"
-#include "darshan-pnetcdf-log-format.h"
-
 extern char *pnetcdf_counter_names[];
 extern char *pnetcdf_f_counter_names[];
 


=====================================
darshan-util/darshan-posix-logutils.c
=====================================
--- a/darshan-util/darshan-posix-logutils.c
+++ b/darshan-util/darshan-posix-logutils.c
@@ -17,7 +17,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "darshan-posix-logutils.h"
+#include "darshan-logutils.h"
 
 /* counter name strings for the POSIX module */
 #define X(a) #a,
@@ -32,9 +32,9 @@ char *posix_f_counter_names[] = {
 
 static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf,
     darshan_record_id* rec_id);
-static int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf);
+static int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf, int ver);
 static void darshan_log_print_posix_file(void *file_rec,
-    char *file_name, char *mnt_pt, char *fs_type);
+    char *file_name, char *mnt_pt, char *fs_type, int ver);
 
 struct darshan_mod_logutil_funcs posix_logutils =
 {
@@ -75,13 +75,13 @@ static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf,
     }
 }
 
-static int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf)
+static int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf, int ver)
 {
     struct darshan_posix_file *file = (struct darshan_posix_file *)posix_buf;
     int ret;
 
     ret = darshan_log_putmod(fd, DARSHAN_POSIX_MOD, file,
-        sizeof(struct darshan_posix_file));
+        sizeof(struct darshan_posix_file), ver);
     if(ret < 0)
         return(-1);
 
@@ -89,7 +89,7 @@ static int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf)
 }
 
 static void darshan_log_print_posix_file(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type)
+    char *mnt_pt, char *fs_type, int ver)
 {
     int i;
     struct darshan_posix_file *posix_file_rec =


=====================================
darshan-util/darshan-posix-logutils.h
=====================================
--- a/darshan-util/darshan-posix-logutils.h
+++ b/darshan-util/darshan-posix-logutils.h
@@ -7,9 +7,6 @@
 #ifndef __DARSHAN_POSIX_LOG_UTILS_H
 #define __DARSHAN_POSIX_LOG_UTILS_H
 
-#include "darshan-logutils.h"
-#include "darshan-posix-log-format.h"
-
 extern char *posix_counter_names[];
 extern char *posix_f_counter_names[];
 



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/8731ade9ebdf93664a369aee29a6af4e2bb3e02f...173d38b85c7fc065820f2f700c3c109b605e036d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20151125/8878c9a8/attachment-0001.html>


More information about the Darshan-commits mailing list