From 173d38b85c7fc065820f2f700c3c109b605e036d Mon Sep 17 00:00:00 2001 From: Shane Snyder Date: Wed, 25 Nov 2015 11:10:03 -0600 Subject: [PATCH] update util interfaces to support mod-specific ver --- darshan-runtime/lib/darshan-core.c | 1 - darshan-util/darshan-bgq-logutils.c | 10 +++++----- darshan-util/darshan-convert.c | 2 +- darshan-util/darshan-hdf5-logutils.c | 10 +++++----- darshan-util/darshan-logutils.c | 7 ++++++- darshan-util/darshan-logutils.h | 10 +++++++--- darshan-util/darshan-mpiio-logutils.c | 10 +++++----- darshan-util/darshan-null-logutils.c | 10 +++++----- darshan-util/darshan-parser.c | 12 ++++++------ darshan-util/darshan-pnetcdf-logutils.c | 10 +++++----- darshan-util/darshan-posix-logutils.c | 10 +++++----- 11 files changed, 50 insertions(+), 42 deletions(-) diff --git a/darshan-runtime/lib/darshan-core.c b/darshan-runtime/lib/darshan-core.c index 27731d9..a216a49 100644 --- a/darshan-runtime/lib/darshan-core.c +++ b/darshan-runtime/lib/darshan-core.c @@ -388,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); diff --git a/darshan-util/darshan-bgq-logutils.c b/darshan-util/darshan-bgq-logutils.c index f054e4b..3029b4b 100644 --- a/darshan-util/darshan-bgq-logutils.c +++ b/darshan-util/darshan-bgq-logutils.c @@ -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 = diff --git a/darshan-util/darshan-convert.c b/darshan-util/darshan-convert.c index 2321aad..657e58f 100644 --- 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); diff --git a/darshan-util/darshan-hdf5-logutils.c b/darshan-util/darshan-hdf5-logutils.c index 5c4677a..c159f31 100644 --- a/darshan-util/darshan-hdf5-logutils.c +++ b/darshan-util/darshan-hdf5-logutils.c @@ -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 = diff --git a/darshan-util/darshan-logutils.c b/darshan-util/darshan-logutils.c index f0f880d..5c87853 100644 --- a/darshan-util/darshan-logutils.c +++ b/darshan-util/darshan-logutils.c @@ -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); diff --git a/darshan-util/darshan-logutils.h b/darshan-util/darshan-logutils.h index d7bfde5..7c07d41 100644 --- 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 */ diff --git a/darshan-util/darshan-mpiio-logutils.c b/darshan-util/darshan-mpiio-logutils.c index 98915db..7a9d5a5 100644 --- a/darshan-util/darshan-mpiio-logutils.c +++ b/darshan-util/darshan-mpiio-logutils.c @@ -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 = diff --git a/darshan-util/darshan-null-logutils.c b/darshan-util/darshan-null-logutils.c index 89d86d7..d490c13 100644 --- a/darshan-util/darshan-null-logutils.c +++ b/darshan-util/darshan-null-logutils.c @@ -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 = diff --git a/darshan-util/darshan-parser.c b/darshan-util/darshan-parser.c index 81b9847..eb33265 100644 --- 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; imod_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, diff --git a/darshan-util/darshan-pnetcdf-logutils.c b/darshan-util/darshan-pnetcdf-logutils.c index 9075c0e..bac853a 100644 --- a/darshan-util/darshan-pnetcdf-logutils.c +++ b/darshan-util/darshan-pnetcdf-logutils.c @@ -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 = diff --git a/darshan-util/darshan-posix-logutils.c b/darshan-util/darshan-posix-logutils.c index ec65790..410fbed 100644 --- a/darshan-util/darshan-posix-logutils.c +++ b/darshan-util/darshan-posix-logutils.c @@ -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 = -- 2.26.2