[Darshan-commits] [Darshan] branch, dev-modular, updated. darshan-2.3.1-130-gf201984

Service Account git at mcs.anl.gov
Thu Aug 6 11:49:28 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  f20198469abb49a27eef6a0d88e7fe8022266ac3 (commit)
       via  3b0dacf7e5b8066fc7d911ed9e96f2f319da479e (commit)
       via  3a362ed5a6ae8e08f3e2edbdb5c9360e42940e12 (commit)
       via  659b579db8c0086e707570feef45c89211fc5d16 (commit)
       via  328425b72ce7b211f940024719aa9aca7f4dbc38 (commit)
      from  158337c98e18596458cf2b3102c3f4a63c2ebfae (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 f20198469abb49a27eef6a0d88e7fe8022266ac3
Author: Shane Snyder <ssnyder at mcs.anl.gov>
Date:   Thu Aug 6 11:48:44 2015 -0500

    logutil definitions for pnetcdf module

commit 3b0dacf7e5b8066fc7d911ed9e96f2f319da479e
Author: Shane Snyder <ssnyder at mcs.anl.gov>
Date:   Thu Aug 6 09:51:54 2015 -0500

    logutil definitions for hdf5 module

commit 3a362ed5a6ae8e08f3e2edbdb5c9360e42940e12
Author: Shane Snyder <ssnyder at mcs.anl.gov>
Date:   Wed Aug 5 17:54:17 2015 -0500

    remove old parser tool

commit 659b579db8c0086e707570feef45c89211fc5d16
Author: Shane Snyder <ssnyder at mcs.anl.gov>
Date:   Wed Aug 5 17:48:12 2015 -0500

    add necessary ld options for hdf5/pnetcdf

commit 328425b72ce7b211f940024719aa9aca7f4dbc38
Author: Shane Snyder <ssnyder at mcs.anl.gov>
Date:   Wed Aug 5 15:05:52 2015 -0500

    add hdf5 and pnetcdf stubs library

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

Summary of changes:
 darshan-runtime/Makefile.in                 |   14 ++-
 darshan-runtime/darshan-base-ld-opts.in     |    2 +
 darshan-runtime/darshan-hdf5-ld-opts        |    3 +
 darshan-runtime/darshan-pnetcdf-ld-opts     |    3 +
 darshan-runtime/lib/darshan-hdf5-stubs.c    |   80 ++++++++++++
 darshan-runtime/lib/darshan-pnetcdf-stubs.c |   77 ++++++++++++
 darshan-util/Makefile.in                    |    9 +-
 darshan-util/darshan-base-parser.c          |  180 ---------------------------
 darshan-util/darshan-hdf5-logutils.c        |  104 +++++++++++++++
 darshan-util/darshan-hdf5-logutils.h        |   23 ++++
 darshan-util/darshan-logutils.c             |    8 +-
 darshan-util/darshan-logutils.h             |    2 +
 darshan-util/darshan-pnetcdf-logutils.c     |  104 +++++++++++++++
 darshan-util/darshan-pnetcdf-logutils.h     |   23 ++++
 14 files changed, 445 insertions(+), 187 deletions(-)
 create mode 100644 darshan-runtime/darshan-hdf5-ld-opts
 create mode 100644 darshan-runtime/darshan-pnetcdf-ld-opts
 create mode 100644 darshan-runtime/lib/darshan-hdf5-stubs.c
 create mode 100644 darshan-runtime/lib/darshan-pnetcdf-stubs.c
 delete mode 100644 darshan-util/darshan-base-parser.c
 create mode 100644 darshan-util/darshan-hdf5-logutils.c
 create mode 100644 darshan-util/darshan-hdf5-logutils.h
 create mode 100644 darshan-util/darshan-pnetcdf-logutils.c
 create mode 100644 darshan-util/darshan-pnetcdf-logutils.h


Diff of changes:
diff --git a/darshan-runtime/Makefile.in b/darshan-runtime/Makefile.in
index 65c9f50..e12238d 100644
--- a/darshan-runtime/Makefile.in
+++ b/darshan-runtime/Makefile.in
@@ -1,4 +1,4 @@
-all: lib/libdarshan.a lib/darshan-null.o
+all: lib/libdarshan.a lib/libdarshan-stubs.a lib/darshan-null.o
 
 DESTDIR =
 srcdir = @srcdir@
@@ -75,12 +75,18 @@ lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h $(DARSHAN_LOG_FORMAT) $(srcdir)
 lib/darshan-hdf5.po: lib/darshan-hdf5.c darshan.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-hdf5-log-format.h | lib
 	$(CC) $(CFLAGS_SHARED) -c $< -o $@
 
+lib/darshan-hdf5-stubs.o: lib/darshan-hdf5-stubs.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
+	$(CC) $(CFLAGS) -c $< -o $@
+
 lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-pnetcdf-log-format.h | lib
 	$(CC) $(CFLAGS) -c $< -o $@
 
 lib/darshan-pnetcdf.po: lib/darshan-pnetcdf.c darshan.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-pnetcdf-log-format.h | lib
 	$(CC) $(CFLAGS_SHARED) -c $< -o $@
 
+lib/darshan-pnetcdf-stubs.o: lib/darshan-pnetcdf-stubs.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
+	$(CC) $(CFLAGS) -c $< -o $@
+
 lib/lookup3.o: lib/lookup3.c
 	$(CC) $(CFLAGS) -c $< -o $@
 
@@ -96,12 +102,16 @@ lib/lookup8.po: lib/lookup8.c
 lib/libdarshan.a: lib/darshan-core-init-finalize.o lib/darshan-core.o lib/darshan-common.o lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o lib/lookup3.o lib/lookup8.o
 	ar rcs $@ $^
 
+lib/libdarshan-stubs.a: lib/darshan-hdf5-stubs.o lib/darshan-pnetcdf-stubs.o
+	ar rcs $@ $^
+
 lib/libdarshan.so: lib/darshan-core-init-finalize.po lib/darshan-core.po lib/darshan-common.po lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po lib/lookup3.po lib/lookup8.po
 	$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $@ $^ -lpthread -lrt -lz -ldl
 
 install:: all
 	install -d $(libdir)
 	install -m 755 lib/libdarshan.a $(libdir)
+	install -m 755 lib/libdarshan-stubs.a $(libdir)
 ifndef DISABLE_LDPRELOAD
 	install -m 755 lib/libdarshan.so $(libdir)
 endif
@@ -124,6 +134,8 @@ endif
 	install -m 755 share/mpi-profile/darshan-bg-f.conf $(datarootdir)/mpi-profile/darshan-bg-f.conf
 	install -m 644 darshan-base-ld-opts $(datarootdir)/darshan-base-ld-opts
 	install -m 644 $(srcdir)/darshan-posix-ld-opts $(datarootdir)/darshan-posix-ld-opts
+	install -m 644 $(srcdir)/darshan-hdf5-ld-opts $(datarootdir)/darshan-hdf5-ld-opts
+	install -m 644 $(srcdir)/darshan-pnetcdf-ld-opts $(datarootdir)/darshan-pnetcdf-ld-opts
 	install -d $(libdir)/pkgconfig
 	install -m 644 lib/pkgconfig/darshan-runtime.pc $(libdir)/pkgconfig/darshan-runtime.pc
 
diff --git a/darshan-runtime/darshan-base-ld-opts.in b/darshan-runtime/darshan-base-ld-opts.in
index 4f7fa6a..3f02f33 100644
--- a/darshan-runtime/darshan-base-ld-opts.in
+++ b/darshan-runtime/darshan-base-ld-opts.in
@@ -1 +1,3 @@
 @@darshan_share_path@/darshan-posix-ld-opts
+@@darshan_share_path@/darshan-hdf5-ld-opts
+@@darshan_share_path@/darshan-pnetcdf-ld-opts
diff --git a/darshan-runtime/darshan-hdf5-ld-opts b/darshan-runtime/darshan-hdf5-ld-opts
new file mode 100644
index 0000000..0aafad8
--- /dev/null
+++ b/darshan-runtime/darshan-hdf5-ld-opts
@@ -0,0 +1,3 @@
+--wrap=H5Fcreate
+--wrap=H5Fopen
+--wrap=H5Fclose
diff --git a/darshan-runtime/darshan-pnetcdf-ld-opts b/darshan-runtime/darshan-pnetcdf-ld-opts
new file mode 100644
index 0000000..135f4a5
--- /dev/null
+++ b/darshan-runtime/darshan-pnetcdf-ld-opts
@@ -0,0 +1,3 @@
+--wrap=ncmpi_create
+--wrap=ncmpi_open
+--wrap=ncmpi_close
diff --git a/darshan-runtime/lib/darshan-hdf5-stubs.c b/darshan-runtime/lib/darshan-hdf5-stubs.c
new file mode 100644
index 0000000..42881c4
--- /dev/null
+++ b/darshan-runtime/lib/darshan-hdf5-stubs.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2015 University of Chicago.
+ * See COPYRIGHT notice in top-level directory.
+ *
+ */
+
+/* This file contains stubs for the H5F functions intercepted by Darshan.
+ * They are defined as weak symbols in order to satisfy dependencies of the
+ * hdf5 wrappers in cases where hdf5 is not being used.
+ */
+
+
+#include "darshan-runtime-config.h"
+#include <stdio.h>
+#include <pthread.h>
+#include <string.h>
+#include "mpi.h"
+#include "darshan.h"
+
+/* hope this doesn't change any time soon */
+typedef int hid_t; 
+typedef int herr_t;
+
+hid_t H5Fcreate(const char *filename, unsigned flags,
+    hid_t create_plist, hid_t access_plist) __attribute__((weak));
+
+hid_t H5Fcreate(const char *filename, unsigned flags,
+    hid_t create_plist, hid_t access_plist)
+{
+    int rank;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if(rank == 0)
+    {
+        fprintf(stderr, "WARNING: Darshan H5Fcreate() stub called; this is probably the result of a link-time problem.\n");
+    }
+
+    return(-1);
+}
+
+hid_t H5Fopen(const char *filename, unsigned flags,
+    hid_t access_plist) __attribute__((weak));
+
+hid_t H5Fopen(const char *filename, unsigned flags,
+    hid_t access_plist)
+{
+    int rank;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if(rank == 0)
+    {
+        fprintf(stderr, "WARNING: Darshan H5Fopen() stub called; this is probably the result of a link-time problem.\n");
+    }
+
+    return(-1);
+}
+
+herr_t H5Fclose(hid_t file_id) __attribute__((weak));
+
+herr_t H5Fclose(hid_t file_id)
+{
+    int rank;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if(rank == 0)
+    {
+        fprintf(stderr, "WARNING: Darshan H5Fclose() stub called; this is probably the result of a link-time problem.\n");
+    }
+
+    return(-1);
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */
diff --git a/darshan-runtime/lib/darshan-pnetcdf-stubs.c b/darshan-runtime/lib/darshan-pnetcdf-stubs.c
new file mode 100644
index 0000000..5c54336
--- /dev/null
+++ b/darshan-runtime/lib/darshan-pnetcdf-stubs.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2015 University of Chicago.
+ * See COPYRIGHT notice in top-level directory.
+ *
+ */
+
+/* This file contains stubs for the ncmpi functions intercepted by Darshan.
+ * They are defined as weak symbols in order to satisfy dependencies of the
+ * pnetcdf wrappers in cases where pnetcdf is not being used.
+ */
+
+#include "darshan-runtime-config.h"
+#include <stdio.h>
+#include <pthread.h>
+#include <string.h>
+#include "mpi.h"
+#include "darshan.h"
+
+int ncmpi_create(MPI_Comm comm, const char *path, 
+    int cmode, MPI_Info info, int *ncidp) __attribute__((weak));
+
+int ncmpi_create(MPI_Comm comm, const char *path, 
+    int cmode, MPI_Info info, int *ncidp)
+{
+    int rank;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if(rank == 0)
+    {
+        fprintf(stderr, "WARNING: Darshan ncmpi_create() stub called; this is probably the result of a link-time problem.\n");
+    }
+
+    return(-1);
+}
+
+int ncmpi_open(MPI_Comm comm, const char *path, 
+    int omode, MPI_Info info, int *ncidp) __attribute__((weak));
+
+int ncmpi_open(MPI_Comm comm, const char *path, 
+    int omode, MPI_Info info, int *ncidp)
+{
+    int rank;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if(rank == 0)
+    {
+        fprintf(stderr, "WARNING: Darshan ncmpi_open() stub called; this is probably the result of a link-time problem.\n");
+    }
+
+    return(-1);
+}
+
+int ncmpi_close(int ncid) __attribute__((weak));
+
+int ncmpi_close(int ncid)
+{
+    int rank;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if(rank == 0)
+    {
+        fprintf(stderr, "WARNING: Darshan ncmpi_close() stub called; this is probably the result of a link-time problem.\n");
+    }
+
+    return(-1);
+
+}
+
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */
diff --git a/darshan-util/Makefile.in b/darshan-util/Makefile.in
index 6b37efa..16802bb 100644
--- a/darshan-util/Makefile.in
+++ b/darshan-util/Makefile.in
@@ -56,10 +56,15 @@ darshan-mpiio-logutils.o: darshan-mpiio-logutils.c darshan-logutils.h darshan-mp
 darshan-mpiio-logutils.po: darshan-mpiio-logutils.c darshan-logutils.h darshan-mpiio-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h | uthash-1.9.2
 	$(CC) $(CFLAGS_SHARED) -c  $< -o $@
 
-libdarshan-util.so: darshan-logutils.po darshan-posix-logutils.po darshan-mpiio-logutils.po
+darshan-hdf5-logutils.o: darshan-hdf5-logutils.c darshan-logutils.h darshan-hdf5-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-hdf5-log-format.h | uthash-1.9.2
+	$(CC) $(CFLAGS) -c  $< -o $@
+darshan-hdf5-logutils.po: darshan-hdf5-logutils.c darshan-logutils.h darshan-hdf5-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-hdf5-log-format.h | uthash-1.9.2
+	$(CC) $(CFLAGS_SHARED) -c  $< -o $@
+
+libdarshan-util.so: darshan-logutils.po darshan-posix-logutils.po darshan-mpiio-logutils.po darshan-hdf5-logutils.po darshan-pnetcdf-logutils.po
 	$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $@ $^ $(LIBS)
 	
-libdarshan-util.a: darshan-logutils.o darshan-posix-logutils.o darshan-mpiio-logutils.o
+libdarshan-util.a: darshan-logutils.o darshan-posix-logutils.o darshan-mpiio-logutils.o darshan-hdf5-logutils.o darshan-pnetcdf-logutils.o
 	ar rcs libdarshan-util.a $^
 
 jenkins: util/bin/jenkins.o lookup3.o
diff --git a/darshan-util/darshan-base-parser.c b/darshan-util/darshan-base-parser.c
deleted file mode 100644
index 0f86f49..0000000
--- a/darshan-util/darshan-base-parser.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2015 University of Chicago.
- * See COPYRIGHT notice in top-level directory.
- *
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <zlib.h>
-#include <time.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <assert.h>
-
-#include "darshan-logutils.h"
-#include "darshan-posix-logutils.h"
-#include "uthash-1.9.2/src/uthash.h"
-
-int main(int argc, char **argv)
-{
-    int ret;
-    int i;
-    char *filename;
-    char tmp_string[4096];
-    darshan_fd fd;
-    struct darshan_header header;
-    struct darshan_job job;
-    struct darshan_record_ref *rec_hash = NULL;
-    struct darshan_record_ref *ref, *tmp;
-    int mount_count;
-    char** mnt_pts;
-    char** fs_types;
-    time_t tmp_time = 0;
-    char *token;
-    char *save;
-    char buffer[DARSHAN_JOB_METADATA_LEN];
-
-    assert(argc == 2);
-    filename = argv[1];
-
-    struct stat sbuf;
-    stat(filename, &sbuf);
-
-    fd = darshan_log_open(filename, "r");
-    if(!fd)
-    {
-        fprintf(stderr, "darshan_log_open() failed to open %s\n.", filename);
-        return(-1);
-    }
-
-    /* read darshan log header */
-    ret = darshan_log_getheader(fd, &header);
-    if(ret < 0)
-    {
-        fprintf(stderr, "darshan_log_getheader() failed to read log header.\n");
-        darshan_log_close(fd);
-        return(-1);
-    }
-
-    /* read darshan job info */
-    ret = darshan_log_getjob(fd, &job);
-    if(ret < 0)
-    {
-        fprintf(stderr, "darshan_log_getjob() failed to read job data.\n");
-        darshan_log_close(fd);
-        return(-1);
-    }
-
-    /* get the original command line for this job */
-    ret = darshan_log_getexe(fd, tmp_string);
-    if(ret < 0)
-    {
-        fprintf(stderr, "Error: unable to read trailing job information.\n");
-        darshan_log_close(fd);
-        return(-1);
-    }
-
-    /* print job summary */
-    printf("# darshan log version: %s\n", header.version_string);
-    printf("# size of POSIX file statistics: %zu bytes\n", sizeof(struct darshan_posix_file));
-    printf("# size of job statistics: %zu bytes\n", sizeof(struct darshan_job));
-    printf("# exe: %s\n", tmp_string);
-    printf("# uid: %" PRId64 "\n", job.uid);
-    printf("# jobid: %" PRId64 "\n", job.jobid);
-    printf("# start_time: %" PRId64 "\n", job.start_time);
-    tmp_time += job.start_time;
-    printf("# start_time_asci: %s", ctime(&tmp_time));
-    printf("# end_time: %" PRId64 "\n", job.end_time);
-    tmp_time = 0;
-    tmp_time += job.end_time;
-    printf("# end_time_asci: %s", ctime(&tmp_time));
-    printf("# nprocs: %" PRId64 "\n", job.nprocs);
-    printf("# run time: %" PRId64 "\n", job.end_time - job.start_time + 1);
-    for(token=strtok_r(job.metadata, "\n", &save);
-        token != NULL;
-        token=strtok_r(NULL, "\n", &save))
-    {
-        char *key;
-        char *value;
-        /* NOTE: we intentionally only split on the first = character.
-         * There may be additional = characters in the value portion
-         * (for example, when storing mpi-io hints).
-         */
-        strcpy(buffer, token);
-        key = buffer;
-        value = index(buffer, '=');
-        if(!value)
-            continue;
-        /* convert = to a null terminator to split key and value */
-        value[0] = '\0';
-        value++;
-        printf("# metadata: %s = %s\n", key, value);
-    }
-
-    /* print out each module found in the log */
-    printf("\n# instrumenation modules registered with darshan\n");
-    printf("# -------------------------------------------------------\n");
-    for(i=0;i < DARSHAN_MAX_MODS; i++)
-    {
-        if(header.mod_map[i].len > 0)
-        {
-            printf("# %s:\tsize=%"PRIu64"\n", darshan_module_names[i], header.mod_map[i].len);
-        }
-        
-    }
-
-    /* get the mount information for this log */
-    ret = darshan_log_getmounts(fd, &mnt_pts, &fs_types, &mount_count);
-    if(ret < 0)
-    {
-        fprintf(stderr, "darshan_log_getmounts() failed to read mount information.\n");
-        darshan_log_close(fd);
-        return(-1);
-    }
-
-    /* print table of mounted file systems */
-    printf("\n# mounted file systems (mount point and fs type)\n");
-    printf("# -------------------------------------------------------\n");
-    for(i=0; i<mount_count; i++)
-    {
-        printf("# mount entry:\t%s\t%s\n", mnt_pts[i], fs_types[i]);
-    }
-
-    /* read hash of darshan records */
-    ret = darshan_log_gethash(fd, &rec_hash);
-    if(ret < 0)
-    {
-        fprintf(stderr, "darshan_log_getmap() failed to read record map.\n");
-        darshan_log_close(fd);
-        return(-1);
-    }
-
-    /* print info for each record stored in the log */
-    printf("\n# records registered with Darshan\n");
-    printf("# -------------------------------------------------------\n");
-    HASH_ITER(hlink, rec_hash, ref, tmp)
-    {
-        printf("# ID: %"PRIu64"\tName: %s\n", ref->rec.id, ref->rec.name);
-    }
-
-    /* free mount info */
-    for(i=0; i<mount_count; i++)
-    {
-        free(mnt_pts[i]);
-        free(fs_types[i]);
-    }
-    if(mount_count > 0)
-    {
-        free(mnt_pts);
-        free(fs_types);
-    }
-
-    darshan_log_close(fd);
-
-    return(0);
-}
diff --git a/darshan-util/darshan-hdf5-logutils.c b/darshan-util/darshan-hdf5-logutils.c
new file mode 100644
index 0000000..d921263
--- /dev/null
+++ b/darshan-util/darshan-hdf5-logutils.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2015 University of Chicago.
+ * See COPYRIGHT notice in top-level directory.
+ *
+ */
+
+#define _GNU_SOURCE
+#include "darshan-util-config.h"
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include "darshan-hdf5-logutils.h"
+
+/* counter name strings for the HDF5 module */
+#define X(a) #a,
+char *hdf5_counter_names[] = {
+    HDF5_COUNTERS
+};
+
+char *hdf5_f_counter_names[] = {
+    HDF5_F_COUNTERS
+};
+#undef X
+
+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)
+{
+    int i;
+    int ret;
+    struct darshan_hdf5_file *file = NULL;
+
+    file = malloc(sizeof(*file));
+    if(!file)
+        return(-1);
+    memset(file, 0, sizeof(*file));
+
+    ret = darshan_log_get_moddat(fd, DARSHAN_HDF5_MOD,
+        (void *)file, sizeof(*file));
+    if(ret == 1)
+    {
+        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;
+    return(ret);
+}
+
+void darshan_log_print_hdf5_file(void *file_rec, char *file_name,
+    char *mnt_pt, char *fs_type)
+{
+    int i;
+    struct darshan_hdf5_file *hdf5_file_rec =
+        (struct darshan_hdf5_file *)file_rec;
+
+    for(i=0; i<HDF5_NUM_INDICES; i++)
+    {
+        DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_HDF5_MOD],
+            hdf5_file_rec->rank, hdf5_file_rec->f_id, hdf5_counter_names[i],
+            hdf5_file_rec->counters[i], file_name, mnt_pt, fs_type);
+    }
+
+    for(i=0; i<HDF5_F_NUM_INDICES; i++)
+    {
+        DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_HDF5_MOD],
+            hdf5_file_rec->rank, hdf5_file_rec->f_id, hdf5_f_counter_names[i],
+            hdf5_file_rec->fcounters[i], file_name, mnt_pt, fs_type);
+    }
+
+    return;
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */
diff --git a/darshan-util/darshan-hdf5-logutils.h b/darshan-util/darshan-hdf5-logutils.h
new file mode 100644
index 0000000..496154f
--- /dev/null
+++ b/darshan-util/darshan-hdf5-logutils.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2015 University of Chicago.
+ * See COPYRIGHT notice in top-level directory.
+ *
+ */
+
+#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[];
+
+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 036a5a5..e126e3f 100644
--- a/darshan-util/darshan-logutils.c
+++ b/darshan-util/darshan-logutils.c
@@ -26,11 +26,11 @@ static int darshan_log_read(darshan_fd fd, void *buf, int len);
 /* 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] =
 {
-    NULL,   /* NULL */
+    NULL,               /* NULL */
     &posix_logutils,    /* POSIX */
-    &mpiio_logutils,   /* MPI-IO */
-    NULL,   /* HDF5 */
-    NULL,   /* PNETCDF */
+    &mpiio_logutils,    /* MPI-IO */
+    &hdf5_logutils,     /* HDF5 */
+    &pnetcdf_logutils,  /* PNETCDF */
     NULL,
     NULL,
     NULL,
diff --git a/darshan-util/darshan-logutils.h b/darshan-util/darshan-logutils.h
index 709ac60..c54ec17 100644
--- a/darshan-util/darshan-logutils.h
+++ b/darshan-util/darshan-logutils.h
@@ -55,6 +55,8 @@ extern struct darshan_mod_logutil_funcs *mod_logutils[DARSHAN_MAX_MODS];
 
 #include "darshan-posix-logutils.h"
 #include "darshan-mpiio-logutils.h"
+#include "darshan-hdf5-logutils.h"
+#include "darshan-pnetcdf-logutils.h"
 
 darshan_fd darshan_log_open(const char *name, const char* mode);
 int darshan_log_getheader(darshan_fd fd, struct darshan_header *header);
diff --git a/darshan-util/darshan-pnetcdf-logutils.c b/darshan-util/darshan-pnetcdf-logutils.c
new file mode 100644
index 0000000..7b96396
--- /dev/null
+++ b/darshan-util/darshan-pnetcdf-logutils.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2015 University of Chicago.
+ * See COPYRIGHT notice in top-level directory.
+ *
+ */
+
+#define _GNU_SOURCE
+#include "darshan-util-config.h"
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include "darshan-pnetcdf-logutils.h"
+
+/* counter name strings for the PNETCDF module */
+#define X(a) #a,
+char *pnetcdf_counter_names[] = {
+    PNETCDF_COUNTERS
+};
+
+char *pnetcdf_f_counter_names[] = {
+    PNETCDF_F_COUNTERS
+};
+#undef X
+
+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)
+{
+    int i;
+    int ret;
+    struct darshan_pnetcdf_file *file = NULL;
+
+    file = malloc(sizeof(*file));
+    if(!file)
+        return(-1);
+    memset(file, 0, sizeof(*file));
+
+    ret = darshan_log_get_moddat(fd, DARSHAN_PNETCDF_MOD,
+        (void *)file, sizeof(*file));
+    if(ret == 1)
+    {
+        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;
+    return(ret);
+}
+
+void darshan_log_print_pnetcdf_file(void *file_rec, char *file_name,
+    char *mnt_pt, char *fs_type)
+{
+    int i;
+    struct darshan_pnetcdf_file *pnetcdf_file_rec =
+        (struct darshan_pnetcdf_file *)file_rec;
+
+    for(i=0; i<PNETCDF_NUM_INDICES; i++)
+    {
+        DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_PNETCDF_MOD],
+            pnetcdf_file_rec->rank, pnetcdf_file_rec->f_id, pnetcdf_counter_names[i],
+            pnetcdf_file_rec->counters[i], file_name, mnt_pt, fs_type);
+    }
+
+    for(i=0; i<PNETCDF_F_NUM_INDICES; i++)
+    {
+        DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_PNETCDF_MOD],
+            pnetcdf_file_rec->rank, pnetcdf_file_rec->f_id, pnetcdf_f_counter_names[i],
+            pnetcdf_file_rec->fcounters[i], file_name, mnt_pt, fs_type);
+    }
+
+    return;
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */
diff --git a/darshan-util/darshan-pnetcdf-logutils.h b/darshan-util/darshan-pnetcdf-logutils.h
new file mode 100644
index 0000000..0cd5fb0
--- /dev/null
+++ b/darshan-util/darshan-pnetcdf-logutils.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2015 University of Chicago.
+ * See COPYRIGHT notice in top-level directory.
+ *
+ */
+
+#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[];
+
+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


hooks/post-receive
--



More information about the Darshan-commits mailing list