[Darshan-commits] [Darshan] branch, dev-modular, updated. darshan-2.3.1-137-g9f20269

Service Account git at mcs.anl.gov
Thu Aug 13 16:00:40 CDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".

The branch, dev-modular has been updated
       via  9f202697a19e98ae8822037260f1ec342033d8f4 (commit)
       via  b2268e7b10a7494ea7df2cfaae622f628bdf701a (commit)
      from  0d7fe6935fdccba8d604962228b5fdb0688f2656 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9f202697a19e98ae8822037260f1ec342033d8f4
Author: Shane Snyder <ssnyder at mcs.anl.gov>
Date:   Thu Aug 13 15:59:42 2015 -0500

    update logutils to use new compression format

commit b2268e7b10a7494ea7df2cfaae622f628bdf701a
Author: Shane Snyder <ssnyder at mcs.anl.gov>
Date:   Wed Aug 12 13:18:09 2015 -0500

    log file format changes
    
    * header is now raw uncompressed, rather than gzip format
    * mapping info stored in header is now in uncompressed terms
    * storing mapping info for job data now

-----------------------------------------------------------------------

Summary of changes:
 darshan-runtime/lib/darshan-core.c      |   97 +++------
 darshan-util/darshan-hdf5-logutils.c    |   53 +++---
 darshan-util/darshan-hdf5-logutils.h    |    5 -
 darshan-util/darshan-logutils.c         |  338 +++++++++++++++++++++----------
 darshan-util/darshan-logutils.h         |   20 ++-
 darshan-util/darshan-mpiio-logutils.c   |   53 +++---
 darshan-util/darshan-mpiio-logutils.h   |    5 -
 darshan-util/darshan-parser.c           |   77 +++++---
 darshan-util/darshan-pnetcdf-logutils.c |   53 +++---
 darshan-util/darshan-pnetcdf-logutils.h |    5 -
 darshan-util/darshan-posix-logutils.c   |   54 +++---
 darshan-util/darshan-posix-logutils.h   |    5 -
 12 files changed, 436 insertions(+), 329 deletions(-)


Diff of changes:
diff --git a/darshan-runtime/lib/darshan-core.c b/darshan-runtime/lib/darshan-core.c
index f25dfe7..b8278cd 100644
--- a/darshan-runtime/lib/darshan-core.c
+++ b/darshan-runtime/lib/darshan-core.c
@@ -88,14 +88,14 @@ static void darshan_get_shared_records(
 static int darshan_log_open_all(
     char *logfile_name, MPI_File *log_fh);
 static int darshan_deflate_buffer(
-    void **pointers, int *lengths, int count, int nocomp_flag,
-    char *comp_buf, int *comp_length);
+    void **pointers, int *lengths, int count, char *comp_buf,
+    int *comp_buf_length);
 static int darshan_log_write_record_hash(
     MPI_File log_fh, struct darshan_core_runtime *core,
     uint64_t *inout_off);
 static int darshan_log_append_all(
     MPI_File log_fh, struct darshan_core_runtime *core, void *buf,
-    int count, uint64_t *inout_off, uint64_t *agg_uncomp_sz);
+    int count, uint64_t *inout_off);
 static void darshan_core_cleanup(
     struct darshan_core_runtime* core);
 
@@ -238,7 +238,6 @@ void darshan_core_shutdown()
     double header1, header2;
     double tm_end;
     uint64_t gz_fp = 0;
-    uint64_t tmp_off = 0;
     MPI_File log_fh;
     MPI_Status status;
 
@@ -380,7 +379,7 @@ void darshan_core_shutdown()
         int comp_buf_sz = 0;
 
         /* compress the job info and the trailing mount/exe data */
-        all_ret = darshan_deflate_buffer(pointers, lengths, 2, 0,
+        all_ret = darshan_deflate_buffer(pointers, lengths, 2,
             final_core->comp_buf, &comp_buf_sz);
         if(all_ret)
         {
@@ -390,7 +389,7 @@ void darshan_core_shutdown()
         else
         {
             /* write the job information, preallocing space for the log header */
-            gz_fp += sizeof(struct darshan_header) + 23; /* gzip headers/trailers ... */
+            gz_fp += sizeof(struct darshan_header);
             all_ret = DARSHAN_MPI_CALL(PMPI_File_write_at)(log_fh, gz_fp,
                 final_core->comp_buf, comp_buf_sz, MPI_BYTE, &status);
             if(all_ret != MPI_SUCCESS)
@@ -400,8 +399,6 @@ void darshan_core_shutdown()
                 unlink(logfile_name);
                 
             }
-
-            /* set the beginning offset of record hash, which follows job info just written */
             gz_fp += comp_buf_sz;
         }
     }
@@ -420,8 +417,9 @@ void darshan_core_shutdown()
     if(internal_timing_flag)
         rec1 = DARSHAN_MPI_CALL(PMPI_Wtime)();
     /* write the record name->id hash to the log file */
+    final_core->log_header.rec_map.off = gz_fp;
     ret = darshan_log_write_record_hash(log_fh, final_core, &gz_fp);
-    tmp_off = final_core->log_header.rec_map.off + final_core->log_header.rec_map.len;
+    final_core->log_header.rec_map.len = gz_fp - final_core->log_header.rec_map.off;
 
     /* error out if unable to write record hash */
     DARSHAN_MPI_CALL(PMPI_Allreduce)(&ret, &all_ret, 1, MPI_INT,
@@ -496,12 +494,11 @@ void darshan_core_shutdown()
                 mod_shared_rec_cnt, &mod_buf, &mod_buf_sz);
         }
 
-        final_core->log_header.mod_map[i].off = tmp_off;
-
         /* append this module's data to the darshan log */
-        ret = darshan_log_append_all(log_fh, final_core, mod_buf, mod_buf_sz,
-            &gz_fp, &(final_core->log_header.mod_map[i].len));
-        tmp_off += final_core->log_header.mod_map[i].len;
+        final_core->log_header.mod_map[i].off = gz_fp;
+        ret = darshan_log_append_all(log_fh, final_core, mod_buf, mod_buf_sz, &gz_fp);
+        final_core->log_header.mod_map[i].len =
+            gz_fp - final_core->log_header.mod_map[i].off;
 
         /* error out if the log append failed */
         DARSHAN_MPI_CALL(PMPI_Allreduce)(&ret, &all_ret, 1, MPI_INT,
@@ -534,39 +531,18 @@ void darshan_core_shutdown()
     /* rank 0 is responsible for writing the log header */
     if(my_rank == 0)
     {
-        void *header_buf = &(final_core->log_header);
-        int header_buf_sz = sizeof(struct darshan_header);
-        int comp_buf_sz = 0;
-
         /* initialize the remaining header fields */
         strcpy(final_core->log_header.version_string, DARSHAN_LOG_VERSION);
         final_core->log_header.magic_nr = DARSHAN_MAGIC_NR;
 
-        /* deflate the header */
-        /* NOTE: the header is not actually compressed because space for it must
-         *       be preallocated before writing. i.e., the "compressed" header
-         *       must be constant sized, sizeof(struct darshan_header) + 23.
-         *       it is still necessary to deflate the header or the resulting log
-         *       file will not be a valid gzip file.
-         */
-        all_ret = darshan_deflate_buffer((void **)&header_buf, &header_buf_sz, 1, 1,
-            final_core->comp_buf, &comp_buf_sz);
-        if(all_ret)
+        all_ret = DARSHAN_MPI_CALL(PMPI_File_write_at)(log_fh, 0, &(final_core->log_header),
+            sizeof(struct darshan_header), MPI_BYTE, &status);
+        if(all_ret != MPI_SUCCESS)
         {
-            fprintf(stderr, "darshan library warning: unable to compress header\n");
+            fprintf(stderr, "darshan library warning: unable to write header to log file %s\n",
+                    logfile_name);
             unlink(logfile_name);
         }
-        else
-        {
-            all_ret = DARSHAN_MPI_CALL(PMPI_File_write_at)(log_fh, 0, final_core->comp_buf,
-                comp_buf_sz, MPI_BYTE, &status);
-            if(all_ret != MPI_SUCCESS)
-            {
-                fprintf(stderr, "darshan library warning: unable to write header to log file %s\n",
-                        logfile_name);
-                unlink(logfile_name);
-            }
-        }
     }
 
     /* error out if unable to write log header */
@@ -1199,12 +1175,11 @@ static int darshan_log_open_all(char *logfile_name, MPI_File *log_fh)
 }
 
 static int darshan_deflate_buffer(void **pointers, int *lengths, int count,
-    int nocomp_flag, char *comp_buf, int *comp_length)
+    char *comp_buf, int *comp_buf_length)
 {
     int ret = 0;
     int i;
     int total_target = 0;
-    int z_comp_level;
     z_stream tmp_stream;
 
     /* just return if there is no data */
@@ -1218,7 +1193,7 @@ static int darshan_deflate_buffer(void **pointers, int *lengths, int count,
     }
     else
     {
-        *comp_length = 0;
+        *comp_buf_length = 0;
         return(0);
     }
 
@@ -1229,10 +1204,9 @@ static int darshan_deflate_buffer(void **pointers, int *lengths, int count,
 
     /* initialize the zlib compression parameters */
     /* TODO: check these parameters? */
-    z_comp_level = nocomp_flag ? Z_NO_COMPRESSION : Z_DEFAULT_COMPRESSION;
-    ret = deflateInit2(&tmp_stream, z_comp_level, Z_DEFLATED,
-        15 + 16, 8, Z_DEFAULT_STRATEGY);
-//    ret = deflateInit(&tmp_stream, z_comp_level);
+//    ret = deflateInit2(&tmp_stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
+//        15 + 16, 8, Z_DEFAULT_STRATEGY);
+    ret = deflateInit(&tmp_stream, Z_DEFAULT_COMPRESSION);
     if(ret != Z_OK)
     {
         return(-1);
@@ -1282,7 +1256,7 @@ static int darshan_deflate_buffer(void **pointers, int *lengths, int count,
     }
     deflateEnd(&tmp_stream);
 
-    *comp_length = tmp_stream.total_out;
+    *comp_buf_length = tmp_stream.total_out;
     return(0);
 }
 
@@ -1352,15 +1326,10 @@ static int darshan_log_write_record_hash(MPI_File log_fh, struct darshan_core_ru
         memcpy(hash_buf_off, ref->rec.name, name_len);
         hash_buf_off += name_len;
     }
-
-    /* store uncompressed offset of the record hash */
-    core->log_header.rec_map.off = sizeof(struct darshan_header) +
-        DARSHAN_JOB_RECORD_SIZE;
+    hash_buf_sz = hash_buf_off - hash_buf;
 
     /* collectively write out the record hash to the darshan log */
-    hash_buf_sz = hash_buf_off - hash_buf;
-    ret = darshan_log_append_all(log_fh, core, hash_buf, hash_buf_sz,
-        inout_off, &(core->log_header.rec_map.len));
+    ret = darshan_log_append_all(log_fh, core, hash_buf, hash_buf_sz, inout_off);
 
     free(hash_buf);
 
@@ -1369,22 +1338,18 @@ static int darshan_log_write_record_hash(MPI_File log_fh, struct darshan_core_ru
 
 /* NOTE: inout_off contains the starting offset of this append at the beginning
  *       of the call, and contains the ending offset at the end of the call.
- *       total_uncomp_sz will store the collective size of the uncompressed
- *       buffer being written. This data is necessary to properly index data
- *       when reading a darshan log. Also, these variables should only be valid
- *       on the root rank (rank 0).
+ *       This variable is only valid on the root rank (rank 0).
  */
 static int darshan_log_append_all(MPI_File log_fh, struct darshan_core_runtime *core,
-    void *buf, int count, uint64_t *inout_off, uint64_t *agg_uncomp_sz)
+    void *buf, int count, uint64_t *inout_off)
 {
     MPI_Offset send_off, my_off;
     MPI_Status status;
-    uint64_t uncomp_buf_sz = count;
     int comp_buf_sz = 0;
     int ret;
 
     /* compress the input buffer */
-    ret = darshan_deflate_buffer((void **)&buf, &count, 1, 0,
+    ret = darshan_deflate_buffer((void **)&buf, &count, 1,
         core->comp_buf, &comp_buf_sz);
     if(ret < 0)
         comp_buf_sz = 0;
@@ -1416,16 +1381,16 @@ static int darshan_log_append_all(MPI_File log_fh, struct darshan_core_runtime *
             core->comp_buf, comp_buf_sz, MPI_BYTE, &status);
     }
 
-    /* send the ending offset from rank (n-1) to rank 0 */
     if(nprocs > 1)
     {
+        /* send the ending offset from rank (n-1) to rank 0 */
         if(my_rank == (nprocs-1))
         {
             my_off += comp_buf_sz;
             DARSHAN_MPI_CALL(PMPI_Send)(&my_off, 1, MPI_OFFSET, 0, 0,
                 MPI_COMM_WORLD);
         }
-        else if(my_rank == 0)
+        if(my_rank == 0)
         {
             DARSHAN_MPI_CALL(PMPI_Recv)(&my_off, 1, MPI_OFFSET, (nprocs-1), 0,
                 MPI_COMM_WORLD, &status);
@@ -1438,10 +1403,6 @@ static int darshan_log_append_all(MPI_File log_fh, struct darshan_core_runtime *
         *inout_off = my_off + comp_buf_sz;
     }
 
-    /* pass back the aggregate uncompressed size of this blob */
-    DARSHAN_MPI_CALL(PMPI_Reduce)(&uncomp_buf_sz, agg_uncomp_sz, 1,
-        MPI_UINT64_T, MPI_SUM, 0, MPI_COMM_WORLD);
-
     if(ret != 0)
         return(-1);
     return(0);
diff --git a/darshan-util/darshan-hdf5-logutils.c b/darshan-util/darshan-hdf5-logutils.c
index af8ee79..80ef43b 100644
--- a/darshan-util/darshan-hdf5-logutils.c
+++ b/darshan-util/darshan-hdf5-logutils.c
@@ -30,49 +30,48 @@ char *hdf5_f_counter_names[] = {
 };
 #undef X
 
+static int darshan_log_get_hdf5_file(darshan_fd fd, void** hdf5_buf_p,
+    int* bytes_left, void** file_rec, darshan_record_id* rec_id);
+static void darshan_log_print_hdf5_file(void *file_rec,
+    char *file_name, char *mnt_pt, char *fs_type);
+
 struct darshan_mod_logutil_funcs hdf5_logutils =
 {
     .log_get_record = &darshan_log_get_hdf5_file,
     .log_print_record = &darshan_log_print_hdf5_file,
 };
 
-int darshan_log_get_hdf5_file(darshan_fd fd, void **file_rec,
-    darshan_record_id *rec_id)
+static int darshan_log_get_hdf5_file(darshan_fd fd, void** hdf5_buf_p,
+    int* bytes_left, void** file_rec, darshan_record_id* rec_id)
 {
     int i;
-    int ret;
-    struct darshan_hdf5_file *file = NULL;
-    *rec_id = 0;
+    struct darshan_hdf5_file *file = (struct darshan_hdf5_file *)
+        (*hdf5_buf_p);
 
-    file = malloc(sizeof(*file));
-    if(!file)
+    if(*bytes_left < sizeof(struct darshan_hdf5_file))
         return(-1);
-    memset(file, 0, sizeof(*file));
 
-    ret = darshan_log_getmod(fd, DARSHAN_HDF5_MOD,
-        (void *)file, sizeof(*file));
-    if(ret == 1)
+    if(fd->swap_flag)
     {
-        if(fd->swap_flag)
-        {
-            /* swap bytes if necessary */
-            DARSHAN_BSWAP64(&file->f_id);
-            DARSHAN_BSWAP64(&file->rank);
-            for(i=0; i<HDF5_NUM_INDICES; i++)
-                DARSHAN_BSWAP64(&file->counters[i]);
-            for(i=0; i<HDF5_F_NUM_INDICES; i++)
-                DARSHAN_BSWAP64(&file->fcounters[i]);
-        }
-
-        /* pass the file record back */
-        *file_rec = (void *)file;
-        *rec_id = file->f_id;
+        /* swap bytes if necessary */
+        DARSHAN_BSWAP64(&file->f_id);
+        DARSHAN_BSWAP64(&file->rank);
+        for(i=0; i<HDF5_NUM_INDICES; i++)
+            DARSHAN_BSWAP64(&file->counters[i]);
+        for(i=0; i<HDF5_F_NUM_INDICES; i++)
+            DARSHAN_BSWAP64(&file->fcounters[i]);
     }
 
-    return(ret);
+    /* update/set output variables */
+    *file_rec = (void *)file;
+    *rec_id = file->f_id;
+    *hdf5_buf_p = (file + 1); /* increment input buf by size of file record */
+    *bytes_left -= sizeof(struct darshan_hdf5_file);
+
+    return(0);
 }
 
-void darshan_log_print_hdf5_file(void *file_rec, char *file_name,
+static void darshan_log_print_hdf5_file(void *file_rec, char *file_name,
     char *mnt_pt, char *fs_type)
 {
     int i;
diff --git a/darshan-util/darshan-hdf5-logutils.h b/darshan-util/darshan-hdf5-logutils.h
index 496154f..91ebd3f 100644
--- a/darshan-util/darshan-hdf5-logutils.h
+++ b/darshan-util/darshan-hdf5-logutils.h
@@ -15,9 +15,4 @@ extern char *hdf5_f_counter_names[];
 
 extern struct darshan_mod_logutil_funcs hdf5_logutils;
 
-int darshan_log_get_hdf5_file(darshan_fd fd, void **file_rec,
-    darshan_record_id *rec_id);
-void darshan_log_print_hdf5_file(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type);
-
 #endif
diff --git a/darshan-util/darshan-logutils.c b/darshan-util/darshan-logutils.c
index 06a37c6..2bfe73d 100644
--- a/darshan-util/darshan-logutils.c
+++ b/darshan-util/darshan-logutils.c
@@ -19,9 +19,13 @@
 
 #include "darshan-logutils.h"
 
+/* TODO: for log reads, we need to make sure the header has been read prior */
+
 static int darshan_log_seek(darshan_fd fd, off_t offset);
 static int darshan_log_read(darshan_fd fd, void *buf, int len);
 static int darshan_log_write(darshan_fd fd, void *buf, int len);
+static int darshan_decompress_buf(char* comp_buf, int comp_buf_sz,
+    char* decomp_buf, int* inout_decomp_buf_sz);
 
 /* TODO: can we make this s.t. we don't care about ordering (i.e., X macro it ) */
 struct darshan_mod_logutil_funcs *mod_logutils[DARSHAN_MAX_MODS] =
@@ -52,20 +56,34 @@ struct darshan_mod_logutil_funcs *mod_logutils[DARSHAN_MAX_MODS] =
  */
 darshan_fd darshan_log_open(const char *name, const char *mode)
 {
+    int o_flags;
     darshan_fd tmp_fd;
 
-    /* we only allows "w" or "r" modes, nothing fancy */
+    /* we only allow "w" or "r" modes, nothing fancy */
     assert(strlen(mode) == 1);
     assert(mode[0] == 'r' || mode[0] == 'w');
 
+    if(mode[0] == 'r')
+    {
+        o_flags = O_RDONLY;
+    }
+    else if (mode[0] == 'w')
+    {
+        /* when writing, we create the log file making sure not to overwrite
+         * an existing log
+         */
+        o_flags = O_WRONLY | O_CREAT | O_EXCL;
+    }
+
     tmp_fd = malloc(sizeof(*tmp_fd));
     if(!tmp_fd)
         return(NULL);
     memset(tmp_fd, 0, sizeof(*tmp_fd));
 
-    tmp_fd->gzf = gzopen(name, mode);
-    if(!tmp_fd->gzf)
+    tmp_fd->fildes = open(name, o_flags);
+    if(tmp_fd->fildes < 0)
     {
+        perror("darshan_log_open: ");
         free(tmp_fd);
         tmp_fd = NULL;
     }
@@ -77,6 +95,7 @@ darshan_fd darshan_log_open(const char *name, const char *mode)
  *
  * read the header of the darshan log and set internal data structures
  * NOTE: this function must be called before reading other portions of the log
+ * NOTE: this is the only portion of the darshan log which is uncompressed
  *
  * returns 0 on success, -1 on failure
  */
@@ -92,7 +111,7 @@ int darshan_log_getheader(darshan_fd fd, struct darshan_header *header)
         return(-1);
     }
 
-    /* read header from log file */
+    /* read uncompressed header from log file */
     ret = darshan_log_read(fd, header, sizeof(*header));
     if(ret != sizeof(*header))
     {
@@ -134,12 +153,15 @@ int darshan_log_getheader(darshan_fd fd, struct darshan_header *header)
     }
 
     /* save the mapping of data within log file to this file descriptor */
+    fd->job_map.off = sizeof(struct darshan_header);
+    fd->job_map.len = header->rec_map.off - fd->job_map.off;
     memcpy(&fd->rec_map, &header->rec_map, sizeof(struct darshan_log_map));
     memcpy(&fd->mod_map, &header->mod_map, DARSHAN_MAX_MODS * sizeof(struct darshan_log_map));
 
     return(0);
 }
 
+#if 0
 /* darshan_log_putheader()
  *
  * write a darshan header to log file
@@ -171,6 +193,7 @@ int darshan_log_putheader(darshan_fd fd, struct darshan_header *header)
 
     return(0);
 }
+#endif
 
 /* darshan_log_getjob()
  *
@@ -180,22 +203,45 @@ int darshan_log_putheader(darshan_fd fd, struct darshan_header *header)
  */
 int darshan_log_getjob(darshan_fd fd, struct darshan_job *job)
 {
+    char *comp_buf;
+    char job_buf[DARSHAN_JOB_RECORD_SIZE] = {0};
+    int job_buf_sz = DARSHAN_JOB_RECORD_SIZE;
     int ret;
 
-    ret = darshan_log_seek(fd, sizeof(struct darshan_header));
+    /* allocate buffer to store compressed job info */
+    comp_buf = malloc(fd->job_map.len);
+    if(!comp_buf)
+        return(-1);
+
+    ret = darshan_log_seek(fd, fd->job_map.off);
     if(ret < 0)
     {
         fprintf(stderr, "Error: unable to seek in darshan log file.\n");
+        free(comp_buf);
         return(-1);
     }
 
-    /* read the job data from the log file */
-    ret = darshan_log_read(fd, job, sizeof(*job));
-    if(ret != sizeof(*job))
+    /* read the compressed job data from the log file */
+    ret = darshan_log_read(fd, comp_buf, fd->job_map.len);
+    if(ret != fd->job_map.len)
     {
         fprintf(stderr, "Error: failed to read darshan log file job data.\n");
+        free(comp_buf);
+        return(-1);
+    }
+
+    /* decompress the job data */
+    ret = darshan_decompress_buf(comp_buf, fd->job_map.len, job_buf, &job_buf_sz);
+    if(ret < 0)
+    {
+        fprintf(stderr, "Error: failed to decompress darshan job data.\n");
+        free(comp_buf);
         return(-1);
     }
+    assert(job_buf_sz == DARSHAN_JOB_RECORD_SIZE);
+    free(comp_buf);
+
+    memcpy(job, job_buf, sizeof(*job));
 
     if(fd->swap_flag)
     {
@@ -207,9 +253,17 @@ int darshan_log_getjob(darshan_fd fd, struct darshan_job *job)
         DARSHAN_BSWAP64(&job->jobid);
     }
 
+    /* save trailing exe & mount information, so it can be retrieved later */
+    if(!fd->exe_mnt_data)
+        fd->exe_mnt_data = malloc(DARSHAN_EXE_LEN+1);
+    if(!fd->exe_mnt_data)
+        return(-1);
+    memcpy(fd->exe_mnt_data, &job_buf[sizeof(*job)], DARSHAN_EXE_LEN+1);
+
     return(0);
 }
 
+#if 0
 /* darshan_log_putjob()
  *
  * write job level metadat to darshan log file
@@ -253,6 +307,7 @@ int darshan_log_putjob(darshan_fd fd, struct darshan_job *job)
 
     return(0);
 }
+#endif
 
 /* darshan_log_getexe()
  *
@@ -262,33 +317,30 @@ int darshan_log_putjob(darshan_fd fd, struct darshan_job *job)
  */
 int darshan_log_getexe(darshan_fd fd, char *buf)
 {
-    int tmp_off = sizeof(struct darshan_header) + sizeof(struct darshan_job);
-    int ret;
     char *newline;
+    int ret;
 
-    ret = darshan_log_seek(fd, tmp_off);
-    if(ret < 0)
+    /* if the exe/mount data has not been saved yet, read in the job info */
+    if(!fd->exe_mnt_data)
     {
-        fprintf(stderr, "Error: unable to seek in darshan log file.\n");
-        return(-1);
-    }
+        struct darshan_job job;
+        ret = darshan_log_getjob(fd, &job);
 
-    /* read the trailing exe data from the darshan log */
-    ret = darshan_log_read(fd, buf, DARSHAN_EXE_LEN+1);
-    if(ret != DARSHAN_EXE_LEN+1)
-    {
-        fprintf(stderr, "Error: failed to read exe string from darshan log file.\n");
-        return(-1);
+        if(ret < 0 || !fd->exe_mnt_data)
+            return(-1);
     }
 
-    /* mount info is stored after the exe string, so truncate there */
-    newline = strchr(buf, '\n');
+    /* exe string is located before the first line break */
+    newline = strchr(fd->exe_mnt_data, '\n');
+
+    /* copy over the exe string */
     if(newline)
-        *newline = '\0';
+        memcpy(buf, fd->exe_mnt_data, (newline - fd->exe_mnt_data));
 
     return (0);
 }
 
+#if 0
 /* darshan_log_putexe()
  *
  * wrties the application exe name to darshan log file
@@ -319,6 +371,7 @@ int darshan_log_putexe(darshan_fd fd, char *buf)
 
     return(0);
 }
+#endif
 
 /* darshan_log_getmounts()
  * 
@@ -331,30 +384,23 @@ int darshan_log_putexe(darshan_fd fd, char *buf)
 int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
     char*** fs_types, int* count)
 {
-    int tmp_off = sizeof(struct darshan_header) + sizeof(struct darshan_job);
-    int ret;
     char *pos;
     int array_index = 0;
-    char buf[DARSHAN_EXE_LEN+1];
+    int ret;
 
-    ret = darshan_log_seek(fd, tmp_off);
-    if(ret < 0)
+    /* if the exe/mount data has not been saved yet, read in the job info */
+    if(!fd->exe_mnt_data)
     {
-        fprintf(stderr, "Error: unable to seek in darshan log file.\n");
-        return(-1);
-    }
+        struct darshan_job job;
+        ret = darshan_log_getjob(fd, &job);
 
-    /* read the trailing mount data from the darshan log */
-    ret = darshan_log_read(fd, buf, DARSHAN_EXE_LEN+1);
-    if(ret != DARSHAN_EXE_LEN+1)
-    {
-        fprintf(stderr, "Error: failed to read mount info from darshan log file.\n");
-        return(-1);
+        if(ret < 0 || !fd->exe_mnt_data)
+            return(-1);
     }
 
     /* count entries */
     *count = 0;
-    pos = buf;
+    pos = fd->exe_mnt_data;
     while((pos = strchr(pos, '\n')) != NULL)
     {
         pos++;
@@ -376,7 +422,7 @@ int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
     /* work backwards through the table and parse each line (except for
      * first, which holds command line information)
      */
-    while((pos = strrchr(buf, '\n')) != NULL)
+    while((pos = strrchr(fd->exe_mnt_data, '\n')) != NULL)
     {
         /* overestimate string lengths */
         (*mnt_pts)[array_index] = malloc(DARSHAN_EXE_LEN);
@@ -399,6 +445,7 @@ int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
     return(0);
 }
 
+#if 0
 /* darshan_log_putmounts()
  *
  * writes mount information to the darshan log file
@@ -436,6 +483,7 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int co
 
     return(0);
 }
+#endif
 
 /* darshan_log_gethash()
  *
@@ -445,8 +493,9 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int co
  */
 int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
 {
+    char *comp_buf;
     char *hash_buf;
-    int hash_buf_sz = fd->rec_map.len;
+    int hash_buf_sz;
     char *buf_ptr;
     darshan_record_id *rec_id_ptr;
     uint32_t *path_len_ptr;
@@ -454,24 +503,43 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
     struct darshan_record_ref *ref;
     int ret;
 
+    /* allocate buffers to store compressed and decompressed record
+     * hash data
+     */
+    comp_buf = malloc(fd->rec_map.len);
+    hash_buf = malloc(DARSHAN_DEF_COMP_BUF_SZ);
+    if(!comp_buf || !hash_buf)
+        return(-1);
+    hash_buf_sz = DARSHAN_DEF_COMP_BUF_SZ;
+    memset(hash_buf, 0, DARSHAN_DEF_COMP_BUF_SZ);
+
     ret = darshan_log_seek(fd, fd->rec_map.off);
     if(ret < 0)
     {
         fprintf(stderr, "Error: unable to seek in darshan log file.\n");
+        free(comp_buf);
         return(-1);
     }
 
-    hash_buf = malloc(hash_buf_sz);
-    if(!hash_buf)
-        return(-1);
-
     /* read the record hash from the log file */
-    ret = darshan_log_read(fd, hash_buf, fd->rec_map.len);
+    ret = darshan_log_read(fd, comp_buf, fd->rec_map.len);
     if(ret != fd->rec_map.len)
     {
         fprintf(stderr, "Error: failed to read record hash from darshan log file.\n");
+        free(comp_buf);
+        return(-1);
+    }
+
+    /* decompress the record hash buffer */
+    ret = darshan_decompress_buf(comp_buf, fd->rec_map.len,
+        hash_buf, &hash_buf_sz);
+    if(ret < 0)
+    {
+        fprintf(stderr, "Error: unable to decompress darshan job data.\n");
+        free(comp_buf);
         return(-1);
     }
+    free(comp_buf);
 
     buf_ptr = hash_buf;
     while(buf_ptr < (hash_buf + hash_buf_sz))
@@ -519,9 +587,11 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
         }
     }
 
+    free(hash_buf);
     return(0);
 }
 
+#if 0
 /* darshan_log_puthash()
  *
  * writes the hash table of records to the darshan log file
@@ -609,60 +679,66 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
 
     return(0);
 }
+#endif
 
 /* darshan_log_getmod()
  *
- * reads a chunk of data for a corresponding darshan instrumentation module
- * NOTE: mod_buf_sz is the uncompressed size of data we wish to read for the given
- * module. chunks of data can be read sequentially for a given module by
- * repeatedly calling this function with the desired chunk sizes.
- *
- * returns 1 on successful read of data, 0 on end of module region, -1 on failure
+ * returns 1 on successful read of module data, 0 on no data, -1 on failure
  */
 int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
-    void *mod_buf, int mod_buf_sz)
+    void *mod_buf, int *mod_buf_sz)
 {
-    int mod_buf_end = fd->mod_map[mod_id].off + fd->mod_map[mod_id].len;
+    char *comp_buf;
     int ret;
 
-    if(!fd->mod_map[mod_id].len || fd->pos == mod_buf_end)
-        return(0); /* no (more) data corresponding to this mod_id */
-
-    /* only seek to start of module data if current log file position 
-     * is not within the given mod_id's range. This allows one to
-     * repeatedly call this function and get chunks of a module's
-     * data piecemeal.
-     */
-    if((fd->pos < fd->mod_map[mod_id].off) || (fd->pos > mod_buf_end))
+    if(mod_id < 0 || mod_id >= DARSHAN_MAX_MODS)
     {
-        ret = darshan_log_seek(fd, fd->mod_map[mod_id].off);
-        if(ret < 0)
-        {
-            fprintf(stderr, "Error: unable to seek in darshan log file.\n");
-            return(-1);
-        }
+        fprintf(stderr, "Error: invalid Darshan module id.\n");
+        return(-1);
     }
 
-    /* if the requested amount of data violates mapping info, error out */
-    if(mod_buf_sz > (mod_buf_end - fd->pos))
-    {
-        fprintf(stderr, "Error: module data read violates stored mapping information.\n");
+    if(fd->mod_map[mod_id].len == 0)
+        return(0); /* no data corresponding to this mod_id */
+
+    comp_buf = malloc(fd->mod_map[mod_id].len);
+    if(!comp_buf)
         return(-1);
+
+    ret = darshan_log_seek(fd, fd->mod_map[mod_id].off);
+    if(ret < 0)
+    {
+        fprintf(stderr, "Error: unable to seek in darshan log file.\n");
+        free(comp_buf);
+        return(ret);
     }
 
-    /* read the module chunk from the log file */
-    ret = darshan_log_read(fd, mod_buf, mod_buf_sz);
-    if(ret != mod_buf_sz)
+    /* read this module's data from the log file */
+    ret = darshan_log_read(fd, comp_buf, fd->mod_map[mod_id].len);
+    if(ret != fd->mod_map[mod_id].len)
     {
         fprintf(stderr,
             "Error: failed to read module %s data from darshan log file.\n",
             darshan_module_names[mod_id]);
+        free(comp_buf);
         return(-1);
     }
 
+    /* decompress this module's data */
+    ret = darshan_decompress_buf(comp_buf, fd->mod_map[mod_id].len,
+        mod_buf, mod_buf_sz);
+    if(ret < 0)
+    {
+        fprintf(stderr, "Error: unable to decompress module %s data.\n",
+            darshan_module_names[mod_id]);
+        free(comp_buf);
+        return(-1);
+    }
+    free(comp_buf);
+
     return(1);
 }
 
+#if 0
 /* darshan_log_putmod()
  *
  * write a chunk of module data to the darshan log file
@@ -715,6 +791,7 @@ int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
 
     return(0);
 }
+#endif 
 
 /* darshan_log_close()
  *
@@ -724,8 +801,11 @@ int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
  */
 void darshan_log_close(darshan_fd fd)
 {
-    if(fd->gzf)
-        gzclose(fd->gzf);
+    if(fd->fildes)
+        close(fd->fildes);
+
+    if(fd->exe_mnt_data)
+        free(fd->exe_mnt_data);
 
     free(fd);
 
@@ -738,22 +818,16 @@ void darshan_log_close(darshan_fd fd)
  */
 static int darshan_log_seek(darshan_fd fd, off_t offset)
 {
-    z_off_t zoff = 0;
-    z_off_t zoff_ret = 0;
+    off_t ret_off;
 
     if(fd->pos == offset)
         return(0);
 
-    if(fd->gzf)
+    ret_off = lseek(fd->fildes, offset, SEEK_SET);
+    if(ret_off == offset)
     {
-        zoff += offset;
-        zoff_ret = gzseek(fd->gzf, zoff, SEEK_SET);
-        if(zoff_ret == zoff)
-        {
-            fd->pos = offset;
-            return(0);
-        }
-        return(-1);
+        fd->pos = offset;
+        return(0);
     }
 
     return(-1);
@@ -765,15 +839,12 @@ static int darshan_log_read(darshan_fd fd, void* buf, int len)
 {
     int ret;
 
-    if(fd->gzf)
-    {
-        ret = gzread(fd->gzf, buf, len);
-        if(ret > 0)
-            fd->pos += ret;
-        return(ret);
-    }
+    /* read data from the log file using the given map */
+    ret = read(fd->fildes, buf, len);
+    if(ret > 0)
+        fd->pos += ret;
 
-    return(-1);
+    return(ret);
 }
 
 /* return amount written on success, -1 on failure.
@@ -782,15 +853,76 @@ static int darshan_log_write(darshan_fd fd, void* buf, int len)
 {
     int ret;
 
-    if(fd->gzf)
+    ret = write(fd->fildes, buf, len);
+    if(ret > 0)
+        fd->pos += ret;
+
+    return(ret);
+}
+
+/* return 0 on successful decompression, -1 on failure
+ */
+static int darshan_decompress_buf(char* comp_buf, int comp_buf_sz,
+    char* decomp_buf, int* inout_decomp_buf_sz)
+{
+    int ret;
+    int total_out = 0;
+    z_stream tmp_stream;
+
+    memset(&tmp_stream, 0, sizeof(tmp_stream));
+    tmp_stream.zalloc = Z_NULL;
+    tmp_stream.zfree = Z_NULL;
+    tmp_stream.opaque = Z_NULL;
+    tmp_stream.next_in = (unsigned char*)comp_buf;
+    tmp_stream.avail_in = comp_buf_sz;
+    tmp_stream.next_out = (unsigned char*)decomp_buf;
+    tmp_stream.avail_out = *inout_decomp_buf_sz;
+
+    /* initialize the zlib decompression parameters */
+    /* TODO: check these parameters? */
+    //ret = inflateInit2(&tmp_stream, 31);
+    ret = inflateInit(&tmp_stream);
+    if(ret != Z_OK)
     {
-        ret = gzwrite(fd->gzf, buf, len);
-        if(ret > 0)
-            fd->pos += ret;
-        return(ret);
+        return(-1);
     }
 
-    return(-1);
+    /* while we have not finished consuming all of the compressed input data */
+    while(tmp_stream.avail_in)
+    {
+        if(tmp_stream.avail_out == 0)
+        {
+            /* We ran out of buffer space for compression.  In theory,
+             * we could just alloc more space, but probably just easier
+             * to bump up the default size of the output buffer.
+             */
+            inflateEnd(&tmp_stream);
+            return(-1);
+        }
+
+        /* decompress data */
+        ret = inflate(&tmp_stream, Z_FINISH);
+        if(ret != Z_STREAM_END)
+        {
+            inflateEnd(&tmp_stream);
+            return(-1);
+        }
+
+        total_out += tmp_stream.total_out;
+        if(tmp_stream.avail_in)
+            inflateReset(&tmp_stream);
+    }
+    inflateEnd(&tmp_stream);
+
+    *inout_decomp_buf_sz = total_out;
+    return(0);
+}
+
+static int darshan_compress_buf(char* decomp_buf, int decomp_buf_sz,
+    char* comp_buf, int* inout_comp_buf_sz)
+{
+
+    return(0);
 }
 
 /*
diff --git a/darshan-util/darshan-logutils.h b/darshan-util/darshan-logutils.h
index dea2691..d00ab5f 100644
--- a/darshan-util/darshan-logutils.h
+++ b/darshan-util/darshan-logutils.h
@@ -16,15 +16,21 @@
 
 #include "darshan-log-format.h"
 
-/* default to a decompression buffer size of 4 MiB */
-#define DARSHAN_DEF_DECOMP_BUF_SZ (4*1024*1024)
+/* default to a buffer size of 4 MiB for compression/decompression */
+#define DARSHAN_DEF_COMP_BUF_SZ (4*1024*1024)
 
+/* TODO: can we refactor this def out of header? modules currently poke at swap_flag
+ * directly, but other than that there's no reason for another module to know this
+ * definition.
+ */
 struct darshan_fd_s
 {
-    gzFile gzf;
+    int fildes;
     int64_t pos;
     char version[8];
     int swap_flag;
+    char *exe_mnt_data;
+    struct darshan_log_map job_map;
     struct darshan_log_map rec_map;
     struct darshan_log_map mod_map[DARSHAN_MAX_MODS];
 };
@@ -40,8 +46,10 @@ struct darshan_mod_logutil_funcs
 {
     int (*log_get_record)(
         darshan_fd fd,
-        void **rec_dat,
-        darshan_record_id *rec_id
+        void** mod_buf_p,
+        int* mod_bytes_left,
+        void** file_rec,
+        darshan_record_id* rec_id
     );
     void (*log_print_record)(
         void *file_rec,
@@ -72,7 +80,7 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts,
 int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash);
 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);
+    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 darshan_log_close(darshan_fd file);
diff --git a/darshan-util/darshan-mpiio-logutils.c b/darshan-util/darshan-mpiio-logutils.c
index f1c1322..d78f470 100644
--- a/darshan-util/darshan-mpiio-logutils.c
+++ b/darshan-util/darshan-mpiio-logutils.c
@@ -30,49 +30,48 @@ char *mpiio_f_counter_names[] = {
 };
 #undef X
 
+static int darshan_log_get_mpiio_file(darshan_fd fd, void** mpiio_buf_p,
+    int* bytes_left, void** file_rec, darshan_record_id* rec_id);
+static void darshan_log_print_mpiio_file(void *file_rec,
+    char *file_name, char *mnt_pt, char *fs_type);
+
 struct darshan_mod_logutil_funcs mpiio_logutils =
 {
     .log_get_record = &darshan_log_get_mpiio_file,
     .log_print_record = &darshan_log_print_mpiio_file,
 };
 
-int darshan_log_get_mpiio_file(darshan_fd fd, void **file_rec,
-    darshan_record_id *rec_id)
+static int darshan_log_get_mpiio_file(darshan_fd fd, void** mpiio_buf_p,
+    int* bytes_left, void** file_rec, darshan_record_id* rec_id)
 {
     int i;
-    int ret;
-    struct darshan_mpiio_file *file = NULL;
-    *rec_id = 0;
+    struct darshan_mpiio_file *file = (struct darshan_mpiio_file *)
+        (*mpiio_buf_p);
 
-    file = malloc(sizeof(*file));
-    if(!file)
+    if(*bytes_left < sizeof(struct darshan_mpiio_file))
         return(-1);
-    memset(file, 0, sizeof(*file));
 
-    ret = darshan_log_getmod(fd, DARSHAN_MPIIO_MOD,
-        (void *)file, sizeof(*file));
-    if(ret == 1)
+    if(fd->swap_flag)
     {
-        if(fd->swap_flag)
-        {
-            /* swap bytes if necessary */
-            DARSHAN_BSWAP64(&file->f_id);
-            DARSHAN_BSWAP64(&file->rank);
-            for(i=0; i<MPIIO_NUM_INDICES; i++)
-                DARSHAN_BSWAP64(&file->counters[i]);
-            for(i=0; i<MPIIO_F_NUM_INDICES; i++)
-                DARSHAN_BSWAP64(&file->fcounters[i]);
-        }
-
-        /* pass the file record back */
-        *file_rec = (void *)file;
-        *rec_id = file->f_id;
+        /* swap bytes if necessary */
+        DARSHAN_BSWAP64(&file->f_id);
+        DARSHAN_BSWAP64(&file->rank);
+        for(i=0; i<MPIIO_NUM_INDICES; i++)
+            DARSHAN_BSWAP64(&file->counters[i]);
+        for(i=0; i<MPIIO_F_NUM_INDICES; i++)
+            DARSHAN_BSWAP64(&file->fcounters[i]);
     }
 
-    return(ret);
+    /* update/set output variables */
+    *file_rec = (void *)file;
+    *rec_id = file->f_id;
+    *mpiio_buf_p = (file + 1); /* increment input buf by size of file record */
+    *bytes_left -= sizeof(struct darshan_mpiio_file);
+
+    return(0);
 }
 
-void darshan_log_print_mpiio_file(void *file_rec, char *file_name,
+static void darshan_log_print_mpiio_file(void *file_rec, char *file_name,
     char *mnt_pt, char *fs_type)
 {
     int i;
diff --git a/darshan-util/darshan-mpiio-logutils.h b/darshan-util/darshan-mpiio-logutils.h
index 4a9507f..3732ba5 100644
--- a/darshan-util/darshan-mpiio-logutils.h
+++ b/darshan-util/darshan-mpiio-logutils.h
@@ -15,9 +15,4 @@ extern char *mpiio_f_counter_names[];
 
 extern struct darshan_mod_logutil_funcs mpiio_logutils;
 
-int darshan_log_get_mpiio_file(darshan_fd fd, void **file_rec,
-    darshan_record_id *rec_id);
-void darshan_log_print_mpiio_file(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type);
-
 #endif
diff --git a/darshan-util/darshan-parser.c b/darshan-util/darshan-parser.c
index dd211a9..c5aacf9 100644
--- a/darshan-util/darshan-parser.c
+++ b/darshan-util/darshan-parser.c
@@ -25,12 +25,12 @@ int main(int argc, char **argv)
     int ret;
     int i, j;
     char *filename;
-    char tmp_string[4096];
+    char tmp_string[4096] = {0};
     darshan_fd fd;
     struct darshan_header header;
     struct darshan_job job;
     struct darshan_record_ref *rec_hash = NULL;
-    struct darshan_record_ref *ref;
+    struct darshan_record_ref *ref, *tmp;
     int mount_count;
     char** mnt_pts;
     char** fs_types;
@@ -39,6 +39,8 @@ int main(int argc, char **argv)
     char *save;
     char buffer[DARSHAN_JOB_METADATA_LEN];
     int empty_mods = 0;
+    char *mod_buf;
+    int mod_buf_sz;
 
     /* TODO: argument parsing */
     assert(argc == 2);
@@ -132,10 +134,10 @@ int main(int argc, char **argv)
     }
 
     /* print breakdown of each log file component's contribution to file size */
-    printf("\n# log file component sizes (decompressed)\n");
+    printf("\n# log file component sizes (compressed)\n");
     printf("# -------------------------------------------------------\n");
-    printf("# header: %zu bytes\n", sizeof(struct darshan_header));
-    printf("# job data: %zu bytes\n", sizeof(struct darshan_job));
+    printf("# header: %zu bytes (uncompressed)\n", sizeof(struct darshan_header));
+    printf("# job data: %zu bytes\n", header.rec_map.off - sizeof(struct darshan_header));
     printf("# record table: %zu bytes\n", header.rec_map.len);
     for(i=0; i<DARSHAN_MAX_MODS; i++)
     {
@@ -154,20 +156,37 @@ int main(int argc, char **argv)
         printf("# mount entry:\t%s\t%s\n", mnt_pts[i], fs_types[i]);
     }
 
+    mod_buf = malloc(DARSHAN_DEF_COMP_BUF_SZ);
+    if(!mod_buf)
+        return(-1);
+
     DARSHAN_PRINT_HEADER();
+    /* TODO: does each module print header of what each counter means??? */
 
     for(i=0; i<DARSHAN_MAX_MODS; i++)
     {
+        int mod_bytes_left;
+        void *mod_buf_p;
         void *rec_p = NULL;
         darshan_record_id rec_id;
 
-        /* skip modules not present in log file */
-        if(header.mod_map[i].len == 0)
+        memset(mod_buf, 0, DARSHAN_DEF_COMP_BUF_SZ);
+        mod_buf_sz = DARSHAN_DEF_COMP_BUF_SZ;
+
+        /* check each module for any data */
+        ret = darshan_log_getmod(fd, i, mod_buf, &mod_buf_sz);
+        if(ret < 0)
         {
+            fprintf(stderr, "Error: failed to get module %s data\n",
+                darshan_module_names[i]);
+            fflush(stderr);
+            darshan_log_close(fd);
+            return(-1);
+        }
+        else if(ret == 0)
+        {
+            /* skip modules not present in log file */
             empty_mods++;
-            if(empty_mods == DARSHAN_MAX_MODS)
-                printf("# no module data available.\n");
-
             continue;
         }
 
@@ -180,15 +199,26 @@ int main(int argc, char **argv)
         }
 
         /* this module has data to be parsed and printed */
-
-        /* TODO: do modules print header of what each counter means??? */
+        mod_buf_p = mod_buf;
+        mod_bytes_left = mod_buf_sz;
 
         /* loop over each of this module's records and print them */
-        while ((ret = mod_logutils[i]->log_get_record(fd, &rec_p, &rec_id)) == 1)
+        while (mod_bytes_left > 0)
         {
             char *mnt_pt = NULL;
             char *fs_type = NULL;
 
+            ret = mod_logutils[i]->log_get_record(fd, &mod_buf_p, &mod_bytes_left,
+                &rec_p, &rec_id);
+            if(ret < 0)
+            {
+                fprintf(stderr, "Error: failed to parse module %s data record\n",
+                    darshan_module_names[i]);
+                fflush(stderr);
+                darshan_log_close(fd);
+                return(-1);
+            }
+
             /* get the pathname for this record */
             HASH_FIND(hlink, rec_hash, &rec_id, sizeof(darshan_record_id), ref);
             assert(ref);
@@ -211,19 +241,17 @@ int main(int argc, char **argv)
             /* print the corresponding module data for this record */
             mod_logutils[i]->log_print_record(rec_p, ref->rec.name,
                 mnt_pt, fs_type);
-
-            /* NOTE: we have to free the given file record data */
-            free(rec_p);
         }
+    }
+    if(empty_mods == DARSHAN_MAX_MODS)
+        printf("# no module data available.\n");
 
-        if(ret < 0)
-        {
-            fprintf(stderr, "Error: failed to parse module %s data\n",
-                darshan_module_names[i]);
-            fflush(stderr);
-            darshan_log_close(fd);
-            return(-1);
-        }
+    /* free record hash data */
+    HASH_ITER(hlink, rec_hash, ref, tmp)
+    {
+        HASH_DELETE(hlink, rec_hash, ref);
+        free(ref->rec.name);
+        free(ref);
     }
 
     /* free mount info */
@@ -238,6 +266,7 @@ int main(int argc, char **argv)
         free(fs_types);
     }
 
+    free(mod_buf);
     darshan_log_close(fd);
 
     return(0);
diff --git a/darshan-util/darshan-pnetcdf-logutils.c b/darshan-util/darshan-pnetcdf-logutils.c
index e8d2db5..98f85c0 100644
--- a/darshan-util/darshan-pnetcdf-logutils.c
+++ b/darshan-util/darshan-pnetcdf-logutils.c
@@ -30,49 +30,48 @@ char *pnetcdf_f_counter_names[] = {
 };
 #undef X
 
+static int darshan_log_get_pnetcdf_file(darshan_fd fd, void** pnetcdf_buf_p,
+    int* bytes_left, void** file_rec, darshan_record_id* rec_id);
+static void darshan_log_print_pnetcdf_file(void *file_rec,
+    char *file_name, char *mnt_pt, char *fs_type);
+
 struct darshan_mod_logutil_funcs pnetcdf_logutils =
 {
     .log_get_record = &darshan_log_get_pnetcdf_file,
     .log_print_record = &darshan_log_print_pnetcdf_file,
 };
 
-int darshan_log_get_pnetcdf_file(darshan_fd fd, void **file_rec,
-    darshan_record_id *rec_id)
+static int darshan_log_get_pnetcdf_file(darshan_fd fd, void** pnetcdf_buf_p,
+    int* bytes_left, void** file_rec, darshan_record_id* rec_id)
 {
     int i;
-    int ret;
-    struct darshan_pnetcdf_file *file = NULL;
-    *rec_id = 0;
+    struct darshan_pnetcdf_file *file = (struct darshan_pnetcdf_file *)
+        (*pnetcdf_buf_p);
 
-    file = malloc(sizeof(*file));
-    if(!file)
+    if(*bytes_left < sizeof(struct darshan_pnetcdf_file))
         return(-1);
-    memset(file, 0, sizeof(*file));
 
-    ret = darshan_log_getmod(fd, DARSHAN_PNETCDF_MOD,
-        (void *)file, sizeof(*file));
-    if(ret == 1)
+    if(fd->swap_flag)
     {
-        if(fd->swap_flag)
-        {
-            /* swap bytes if necessary */
-            DARSHAN_BSWAP64(&file->f_id);
-            DARSHAN_BSWAP64(&file->rank);
-            for(i=0; i<PNETCDF_NUM_INDICES; i++)
-                DARSHAN_BSWAP64(&file->counters[i]);
-            for(i=0; i<PNETCDF_F_NUM_INDICES; i++)
-                DARSHAN_BSWAP64(&file->fcounters[i]);
-        }
-
-        /* pass the file record back */
-        *file_rec = (void *)file;
-        *rec_id = file->f_id;
+        /* swap bytes if necessary */
+        DARSHAN_BSWAP64(&file->f_id);
+        DARSHAN_BSWAP64(&file->rank);
+        for(i=0; i<PNETCDF_NUM_INDICES; i++)
+            DARSHAN_BSWAP64(&file->counters[i]);
+        for(i=0; i<PNETCDF_F_NUM_INDICES; i++)
+            DARSHAN_BSWAP64(&file->fcounters[i]);
     }
 
-    return(ret);
+    /* update/set output variables */
+    *file_rec = (void *)file;
+    *rec_id = file->f_id;
+    *pnetcdf_buf_p = (file + 1); /* increment input buf by size of file record */
+    *bytes_left -= sizeof(struct darshan_pnetcdf_file);
+
+    return(0);
 }
 
-void darshan_log_print_pnetcdf_file(void *file_rec, char *file_name,
+static void darshan_log_print_pnetcdf_file(void *file_rec, char *file_name,
     char *mnt_pt, char *fs_type)
 {
     int i;
diff --git a/darshan-util/darshan-pnetcdf-logutils.h b/darshan-util/darshan-pnetcdf-logutils.h
index 0cd5fb0..9645717 100644
--- a/darshan-util/darshan-pnetcdf-logutils.h
+++ b/darshan-util/darshan-pnetcdf-logutils.h
@@ -15,9 +15,4 @@ extern char *pnetcdf_f_counter_names[];
 
 extern struct darshan_mod_logutil_funcs pnetcdf_logutils;
 
-int darshan_log_get_pnetcdf_file(darshan_fd fd, void **file_rec,
-    darshan_record_id *rec_id);
-void darshan_log_print_pnetcdf_file(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type);
-
 #endif
diff --git a/darshan-util/darshan-posix-logutils.c b/darshan-util/darshan-posix-logutils.c
index 9df0c8f..18ef014 100644
--- a/darshan-util/darshan-posix-logutils.c
+++ b/darshan-util/darshan-posix-logutils.c
@@ -30,49 +30,49 @@ char *posix_f_counter_names[] = {
 };
 #undef X
 
+static int darshan_log_get_posix_file(darshan_fd fd, void** psx_buf_p,
+    int* bytes_left, void** file_rec, darshan_record_id* rec_id);
+static void darshan_log_print_posix_file(void *file_rec,
+    char *file_name, char *mnt_pt, char *fs_type);
+
 struct darshan_mod_logutil_funcs posix_logutils =
 {
     .log_get_record = &darshan_log_get_posix_file,
     .log_print_record = &darshan_log_print_posix_file,
 };
 
-int darshan_log_get_posix_file(darshan_fd fd, void **file_rec,
-    darshan_record_id *rec_id)
+static int darshan_log_get_posix_file(darshan_fd fd, void** psx_buf_p,
+    int* bytes_left, void **file_rec, darshan_record_id* rec_id)
 {
     int i;
-    int ret;
-    struct darshan_posix_file *file = NULL;
-    *rec_id = 0;
+    struct darshan_posix_file *file = (struct darshan_posix_file *)
+        (*psx_buf_p);
 
-    file = malloc(sizeof(*file));
-    if(!file)
+    if(*bytes_left < sizeof(struct darshan_posix_file))
         return(-1);
-    memset(file, 0, sizeof(*file));
 
-    ret = darshan_log_getmod(fd, DARSHAN_POSIX_MOD,
-        (void *)file, sizeof(*file));
-    if(ret == 1)
+    if(fd->swap_flag)
     {
-        if(fd->swap_flag)
-        {
-            /* swap bytes if necessary */
-            DARSHAN_BSWAP64(&file->f_id);
-            DARSHAN_BSWAP64(&file->rank);
-            for(i=0; i<POSIX_NUM_INDICES; i++)
-                DARSHAN_BSWAP64(&file->counters[i]);
-            for(i=0; i<POSIX_F_NUM_INDICES; i++)
-                DARSHAN_BSWAP64(&file->fcounters[i]);
-        }
-
-        /* pass the file record back */
-        *file_rec = (void *)file;
-        *rec_id = file->f_id;
+        /* swap bytes if necessary */
+        DARSHAN_BSWAP64(&file->f_id);
+        DARSHAN_BSWAP64(&file->rank);
+        for(i=0; i<POSIX_NUM_INDICES; i++)
+            DARSHAN_BSWAP64(&file->counters[i]);
+        for(i=0; i<POSIX_F_NUM_INDICES; i++)
+            DARSHAN_BSWAP64(&file->fcounters[i]);
     }
 
-    return(ret);
+    /* update/set output variables */
+    *file_rec = (void *)file;
+    *rec_id = file->f_id;
+    *psx_buf_p = (file + 1); /* increment input buf by size of file record */
+    //((struct darshan_posix_file *)(*psx_buf_p))++;
+    *bytes_left -= sizeof(struct darshan_posix_file);
+
+    return(0);
 }
 
-void darshan_log_print_posix_file(void *file_rec, char *file_name,
+static void darshan_log_print_posix_file(void *file_rec, char *file_name,
     char *mnt_pt, char *fs_type)
 {
     int i;
diff --git a/darshan-util/darshan-posix-logutils.h b/darshan-util/darshan-posix-logutils.h
index b94060a..b641dbd 100644
--- a/darshan-util/darshan-posix-logutils.h
+++ b/darshan-util/darshan-posix-logutils.h
@@ -15,9 +15,4 @@ extern char *posix_f_counter_names[];
 
 extern struct darshan_mod_logutil_funcs posix_logutils;
 
-int darshan_log_get_posix_file(darshan_fd fd, void **file_rec,
-    darshan_record_id *rec_id);
-void darshan_log_print_posix_file(void *file_rec, char *file_name,
-    char *mnt_pt, char *fs_type);
-
 #endif


hooks/post-receive
--



More information about the Darshan-commits mailing list