[Darshan-commits] [Git][darshan/darshan][master] 3 commits: add 3.00 log version warning to darshan parser

Shane Snyder xgitlab at cels.anl.gov
Thu Jul 7 12:29:12 CDT 2016


Shane Snyder pushed to branch master at darshan / darshan


Commits:
e1ad9514 by Shane Snyder at 2016-07-07T10:23:28-05:00
add 3.00 log version warning to darshan parser

- - - - -
73c5f0c9 by Shane Snyder at 2016-07-07T10:48:18-05:00
cleanup bgq up-convert code

- - - - -
835019e4 by Shane Snyder at 2016-07-07T10:48:27-05:00
bump log format version to match lib version

- - - - -


5 changed files:

- darshan-log-format.h
- darshan-util/darshan-bgq-logutils.c
- darshan-util/darshan-logutils.c
- darshan-util/darshan-logutils.h
- darshan-util/darshan-parser.c


Changes:

=====================================
darshan-log-format.h
=====================================
--- a/darshan-log-format.h
+++ b/darshan-log-format.h
@@ -20,7 +20,7 @@
 #endif
 
 /* update this on file format changes */
-#define DARSHAN_LOG_VERSION "3.01"
+#define DARSHAN_LOG_VERSION "3.10"
 
 /* magic number for validating output files and checking byte order */
 #define DARSHAN_MAGIC_NR 6567223


=====================================
darshan-util/darshan-bgq-logutils.c
=====================================
--- a/darshan-util/darshan-bgq-logutils.c
+++ b/darshan-util/darshan-bgq-logutils.c
@@ -30,14 +30,7 @@ char *bgq_f_counter_names[] = {
 };
 #undef X
 
-/* old definitions for enforcing backwards compatibility */
-struct darshan_bgq_record_1
-{
-    struct darshan_base_record base_rec;
-    int alignment;
-    int64_t counters[BGQ_NUM_INDICES];
-    double fcounters[BGQ_F_NUM_INDICES];
-};
+#define DARSHAN_BGQ_FILE_SIZE_1 (112 + sizeof(int))
 
 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, int ver);
@@ -60,9 +53,9 @@ struct darshan_mod_logutil_funcs bgq_logutils =
 
 static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf)
 {
-    int log_rec_len;
-    struct darshan_bgq_record *rec =
-        (struct darshan_bgq_record *)bgq_buf;
+    struct darshan_bgq_record *rec = (struct darshan_bgq_record *)bgq_buf;
+    int rec_len;
+    char *buffer, *p;
     int i;
     int ret = -1;
 
@@ -71,32 +64,34 @@ static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf)
      */
     if(fd->mod_ver[DARSHAN_BGQ_MOD] == 1)
     {
-        struct darshan_bgq_record_1 bgq_rec_1;
-        log_rec_len = sizeof(struct darshan_bgq_record_1);
+        buffer = malloc(DARSHAN_BGQ_FILE_SIZE_1);
+        if(!buffer)
+            return(-1);
 
-        ret = darshan_log_get_mod(fd, DARSHAN_BGQ_MOD, &bgq_rec_1,
-            log_rec_len);
-        if(ret == log_rec_len)
+        rec_len = DARSHAN_BGQ_FILE_SIZE_1;
+        ret = darshan_log_get_mod(fd, DARSHAN_BGQ_MOD, buffer, rec_len);
+        if(ret == rec_len)
         {
             /* up-convert old BGQ format to new format */
-            rec->base_rec = bgq_rec_1.base_rec;
-            memcpy(rec->counters, bgq_rec_1.counters,
-                BGQ_NUM_INDICES * sizeof(int64_t));
-            memcpy(rec->fcounters, bgq_rec_1.fcounters,
-                BGQ_F_NUM_INDICES * sizeof(double));
+            p = buffer;
+            memcpy(&(rec->base_rec), p, sizeof(struct darshan_base_record));
+            p += sizeof(struct darshan_base_record);
+            p += sizeof(int);
+            memcpy(&(rec->counters[0]), p, BGQ_NUM_INDICES * sizeof(int64_t));
+            p += (BGQ_NUM_INDICES * sizeof(int64_t));
+            memcpy(&(rec->fcounters[0]), p, BGQ_F_NUM_INDICES * sizeof(double));
         }
+        free(buffer);
     }
     else if(fd->mod_ver[DARSHAN_BGQ_MOD] == 2)
     {
-        log_rec_len = sizeof(struct darshan_bgq_record);
-
-        ret = darshan_log_get_mod(fd, DARSHAN_BGQ_MOD, rec,
-            log_rec_len);
+        rec_len = sizeof(struct darshan_bgq_record);
+        ret = darshan_log_get_mod(fd, DARSHAN_BGQ_MOD, rec, rec_len);
     }
 
     if(ret < 0)
         return(-1);
-    else if(ret < log_rec_len)
+    else if(ret < rec_len)
         return(0);
     else
     {


=====================================
darshan-util/darshan-logutils.c
=====================================
--- a/darshan-util/darshan-logutils.c
+++ b/darshan-util/darshan-logutils.c
@@ -763,6 +763,19 @@ void darshan_log_close(darshan_fd fd)
     return;
 }
 
+void darshan_log_print_version_warnings(const char *version_string)
+{
+    if(strcmp(version_string, "3.00") == 0)
+    {
+        printf("# WARNING: version 3.00 log format has the following limitations:\n");
+        printf("# - Partial instrumentation of stdio stream I/O functions not parsable by Darshan versions >= 3.1.0\n");
+        printf("#     * Using darshan-logutils versions < 3.1.0, this data can be found in the following POSIX counters:\n");
+        printf("#         * POSIX_FOPENS, POSIX_FREADS, POSIX_FWRITES, POSIX_FSEEKS\n");
+    }
+
+    return;
+}
+
 /********************************************************
  *             internal helper functions                *
  ********************************************************/


=====================================
darshan-util/darshan-logutils.h
=====================================
--- a/darshan-util/darshan-logutils.h
+++ b/darshan-util/darshan-logutils.h
@@ -146,6 +146,7 @@ int darshan_log_get_mod(darshan_fd fd, darshan_module_id mod_id,
 int darshan_log_put_mod(darshan_fd fd, darshan_module_id mod_id,
     void *mod_buf, int mod_buf_sz, int ver);
 void darshan_log_close(darshan_fd file);
+void darshan_log_print_version_warnings(const char *version_string);
 
 /* convenience macros for printing Darshan counters */
 #define DARSHAN_PRINT_HEADER() \


=====================================
darshan-util/darshan-parser.c
=====================================
--- a/darshan-util/darshan-parser.c
+++ b/darshan-util/darshan-parser.c
@@ -262,6 +262,9 @@ int main(int argc, char **argv)
         return(-1);
     }
 
+    /* print any warnings related to this log file version */
+    darshan_log_print_version_warnings(fd->version);
+
     if(fd->comp_type == DARSHAN_ZLIB_COMP)
         comp_str = "ZLIB";
     else if (fd->comp_type == DARSHAN_BZIP2_COMP)



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/77323cd7f29e3ebfa646b7fdabf3a7236a0fd1ff...835019e480b222637c47a41c924fdefa5865649b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20160707/e8a5423e/attachment-0001.html>


More information about the Darshan-commits mailing list