From 8732926c1fd5721b73f698d089b68ec94334e296 Mon Sep 17 00:00:00 2001 From: Shane Snyder Date: Wed, 29 Nov 2023 16:47:25 -0600 Subject: [PATCH] whitespace changes and other small things * move various LDMS code so it's contiguous where possible * various indentation/whitespace changes * remove unused dC vars * fix source copyright --- darshan-runtime/lib/darshan-core.c | 4 +- darshan-runtime/lib/darshan-hdf5.c | 91 ++++++++++++++--------------- darshan-runtime/lib/darshan-ldms.c | 29 +++++---- darshan-runtime/lib/darshan-ldms.h | 6 -- darshan-runtime/lib/darshan-mpiio.c | 43 +++++--------- darshan-runtime/lib/darshan-posix.c | 14 ++--- darshan-runtime/lib/darshan-stdio.c | 24 ++++---- darshan-runtime/lib/darshan.h | 1 - 8 files changed, 94 insertions(+), 118 deletions(-) diff --git a/darshan-runtime/lib/darshan-core.c b/darshan-runtime/lib/darshan-core.c index d038c80e3..a3b6bdec6 100644 --- a/darshan-runtime/lib/darshan-core.c +++ b/darshan-runtime/lib/darshan-core.c @@ -211,6 +211,7 @@ void darshan_core_initialize(int argc, char **argv) /* setup darshan runtime if darshan is enabled and hasn't been initialized already */ if (__darshan_core != NULL || getenv("DARSHAN_DISABLE")) return; + init_start = darshan_core_wtime_absolute(); /* allocate structure to track darshan core runtime information */ @@ -356,7 +357,7 @@ void darshan_core_initialize(int argc, char **argv) /* pass init_core to darshan-ldms connector initialization*/ darshan_ldms_connector_initialize(init_core); #endif - + /* if darshan was successfully initialized, set the global pointer * and record absolute start time so that we can later generate * relative times with this as a reference point. @@ -776,7 +777,6 @@ void darshan_core_shutdown(int write_log) free(mod_shared_recs); } #endif - free(logfile_name); return; diff --git a/darshan-runtime/lib/darshan-hdf5.c b/darshan-runtime/lib/darshan-hdf5.c index fbcfd6264..0f551473e 100644 --- a/darshan-runtime/lib/darshan-hdf5.c +++ b/darshan-runtime/lib/darshan-hdf5.c @@ -26,9 +26,9 @@ #include "darshan.h" #include "darshan-dynamic.h" +#include "darshan-ldms.h" #include -#include "darshan-ldms.h" /* H5F prototypes */ DARSHAN_FORWARD_DECL(H5Fcreate, hid_t, (const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist)); @@ -167,7 +167,6 @@ static int my_rank = -1; darshan_record_id __rec_id; \ struct hdf5_file_record_ref *__rec_ref; \ char *__newpath; \ - extern struct darshanConnector dC; \ __newpath = darshan_clean_file_path(__path); \ if(!__newpath) __newpath = (char *)__path; \ __rec_id = darshan_core_gen_record_id(__newpath); \ @@ -187,10 +186,11 @@ static int my_rank = -1; __tm1, __tm2, __rec_ref->last_meta_end); \ darshan_add_record_ref(&(hdf5_file_runtime->hid_hash), &__ret, sizeof(hid_t), __rec_ref); \ if(__newpath != __path) free(__newpath); \ - /* LDMS to publish realtime read tracing information to daemon*/ \ + /* LDMS to publish realtime open tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.hdf5_enable_ldms)\ - darshan_ldms_connector_send(__rec_ref->file_rec->base_rec.id, __rec_ref->file_rec->base_rec.rank,__rec_ref->file_rec->counters[H5F_OPENS], "open", -1, -1, -1, -1, __rec_ref->file_rec->counters[H5F_FLUSHES], __tm1, __tm2, __rec_ref->file_rec->fcounters[H5F_F_META_TIME], "H5F", "MET");\ + darshan_ldms_connector_send(__rec_ref->file_rec->base_rec.id, __rec_ref->file_rec->base_rec.rank,__rec_ref->file_rec->counters[H5F_OPENS], "open", -1, -1, -1, -1, __rec_ref->file_rec->counters[H5F_FLUSHES], __tm1, __tm2, __rec_ref->file_rec->fcounters[H5F_F_META_TIME], "H5F", "MET");\ } while(0) hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags, @@ -447,12 +447,12 @@ herr_t DARSHAN_DECL(H5Fclose)(hid_t file_id) &file_id, sizeof(hid_t)); #ifdef HAVE_LDMS - rec_ref->close_counts++; - /* publish close information for h5f */ - extern struct darshanConnector dC; - if(dC.ldms_lib) - if(dC.hdf5_enable_ldms) - darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->close_counts, "close", -1, -1, -1, -1, rec_ref->file_rec->counters[H5F_FLUSHES], tm1, tm2, rec_ref->file_rec->fcounters[H5F_F_META_TIME], "H5F", "MOD"); + rec_ref->close_counts++; + /* publish close information for h5f */ + extern struct darshanConnector dC; + if(dC.ldms_lib) + if(dC.hdf5_enable_ldms) + darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->close_counts, "close", -1, -1, -1, -1, rec_ref->file_rec->counters[H5F_FLUSHES], tm1, tm2, rec_ref->file_rec->fcounters[H5F_F_META_TIME], "H5F", "MOD"); #endif } H5F_POST_RECORD(); @@ -495,7 +495,6 @@ herr_t DARSHAN_DECL(H5Fclose)(hid_t file_id) ssize_t __req_name_len = DARSHAN_HDF5_MAX_NAME_LEN-1, __ret_name_len; \ darshan_record_id __rec_id, __file_rec_id = 0; \ struct hdf5_dataset_record_ref *__rec_ref; \ - extern struct darshanConnector dC; \ hsize_t __chunk_dims[H5D_MAX_NDIMS] = {0}; \ int __i, __n_chunk_dims = 0; \ /* get corresponding file name */\ @@ -539,16 +538,17 @@ herr_t DARSHAN_DECL(H5Fclose)(hid_t file_id) if(__dcpl_id != H5P_DEFAULT && H5Pget_layout(__dcpl_id) == H5D_CHUNKED) { \ __n_chunk_dims = H5Pget_chunk(__dcpl_id, H5D_MAX_NDIMS, __chunk_dims); \ __n_chunk_dims = (__n_chunk_dims < H5D_MAX_NDIMS) ? __n_chunk_dims : H5D_MAX_NDIMS; \ - for(__i = 0; __i < __n_chunk_dims; __i++){ \ - __rec_ref->dataset_rec->counters[H5D_CHUNK_SIZE_D1 + __i] = __chunk_dims[__n_chunk_dims - __i - 1];} \ - }\ + for(__i = 0; __i < __n_chunk_dims; __i++) \ + __rec_ref->dataset_rec->counters[H5D_CHUNK_SIZE_D1 + __i] = __chunk_dims[__n_chunk_dims - __i - 1]; \ + } \ __rec_ref->dataset_rec->counters[H5D_DATATYPE_SIZE] = H5Tget_size(__type_id); \ __rec_ref->dataset_rec->file_rec_id = __file_rec_id; \ darshan_add_record_ref(&(hdf5_dataset_runtime->hid_hash), &__ret, sizeof(hid_t), __rec_ref); \ /* LDMS to publish runtime h5d tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.hdf5_enable_ldms)\ - darshan_ldms_connector_send(__rec_ref->dataset_rec->base_rec.id, __rec_ref->dataset_rec->base_rec.rank,__rec_ref->dataset_rec->counters[H5D_OPENS], "open", -1, -1, -1, -1, __rec_ref->dataset_rec->counters[H5D_FLUSHES], __tm1, __tm2, __rec_ref->dataset_rec->fcounters[H5D_F_META_TIME], "H5D", "MET");\ + darshan_ldms_connector_send(__rec_ref->dataset_rec->base_rec.id, __rec_ref->dataset_rec->base_rec.rank,__rec_ref->dataset_rec->counters[H5D_OPENS], "open", -1, -1, -1, -1, __rec_ref->dataset_rec->counters[H5D_FLUSHES], __tm1, __tm2, __rec_ref->dataset_rec->fcounters[H5D_F_META_TIME], "H5D", "MET");\ } while(0) hid_t DARSHAN_DECL(H5Dcreate1)(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) @@ -797,19 +797,19 @@ herr_t DARSHAN_DECL(H5Dread)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spac tm1, tm2, rec_ref->last_read_end); #ifdef HAVE_LDMS - /* LDMS to publish runtime h5d tracing information to daemon*/ - extern struct darshanConnector dC; - if(dC.ldms_lib){ - if(dC.hdf5_enable_ldms){ - dC.hdf5_data[0] = rec_ref->dataset_rec->counters[H5D_POINT_SELECTS]; - dC.hdf5_data[1] = rec_ref->dataset_rec->counters[H5D_IRREGULAR_HYPERSLAB_SELECTS]; - dC.hdf5_data[2] = rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS]; - dC.hdf5_data[3] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NDIMS]; - dC.hdf5_data[4] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NPOINTS]; - - darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->dataset_rec->counters[H5D_READS], "read", -1, rec_ref->dataset_rec->counters[H5D_MAX_READ_TIME_SIZE], -1, rec_ref->dataset_rec->counters[H5D_RW_SWITCHES], rec_ref->dataset_rec->counters[H5D_FLUSHES], tm1, tm2, rec_ref->dataset_rec->fcounters[H5D_F_READ_TIME], "H5D", "MOD"); + /* LDMS to publish runtime h5d tracing information to daemon*/ + extern struct darshanConnector dC; + if(dC.ldms_lib){ + if(dC.hdf5_enable_ldms){ + dC.hdf5_data[0] = rec_ref->dataset_rec->counters[H5D_POINT_SELECTS]; + dC.hdf5_data[1] = rec_ref->dataset_rec->counters[H5D_IRREGULAR_HYPERSLAB_SELECTS]; + dC.hdf5_data[2] = rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS]; + dC.hdf5_data[3] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NDIMS]; + dC.hdf5_data[4] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NPOINTS]; + + darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->dataset_rec->counters[H5D_READS], "read", -1, rec_ref->dataset_rec->counters[H5D_MAX_READ_TIME_SIZE], -1, rec_ref->dataset_rec->counters[H5D_RW_SWITCHES], rec_ref->dataset_rec->counters[H5D_FLUSHES], tm1, tm2, rec_ref->dataset_rec->fcounters[H5D_F_READ_TIME], "H5D", "MOD"); + } } - } #endif } H5D_POST_RECORD(); @@ -929,20 +929,19 @@ herr_t DARSHAN_DECL(H5Dwrite)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spa tm1, tm2, rec_ref->last_write_end); #ifdef HAVE_LDMS - /* LDMS to publish runtime h5d tracing information to daemon*/ - extern struct darshanConnector dC; - if(dC.ldms_lib){ - if(dC.hdf5_enable_ldms){ - dC.hdf5_data[0] = rec_ref->dataset_rec->counters[H5D_POINT_SELECTS]; - dC.hdf5_data[1] = rec_ref->dataset_rec->counters[H5D_IRREGULAR_HYPERSLAB_SELECTS]; - dC.hdf5_data[2] = rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS]; - dC.hdf5_data[3] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NDIMS]; - dC.hdf5_data[4] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NPOINTS]; - - darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->dataset_rec->counters[H5D_WRITES], "write", -1, rec_ref->dataset_rec->counters[H5D_MAX_WRITE_TIME_SIZE], -1, rec_ref->dataset_rec->counters[H5D_RW_SWITCHES], rec_ref->dataset_rec->counters[H5D_FLUSHES], tm1, tm2, rec_ref->dataset_rec->fcounters[H5D_F_WRITE_TIME], "H5D", "MOD"); - + /* LDMS to publish runtime h5d tracing information to daemon*/ + extern struct darshanConnector dC; + if(dC.ldms_lib){ + if(dC.hdf5_enable_ldms){ + dC.hdf5_data[0] = rec_ref->dataset_rec->counters[H5D_POINT_SELECTS]; + dC.hdf5_data[1] = rec_ref->dataset_rec->counters[H5D_IRREGULAR_HYPERSLAB_SELECTS]; + dC.hdf5_data[2] = rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS]; + dC.hdf5_data[3] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NDIMS]; + dC.hdf5_data[4] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NPOINTS]; + + darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->dataset_rec->counters[H5D_WRITES], "write", -1, rec_ref->dataset_rec->counters[H5D_MAX_WRITE_TIME_SIZE], -1, rec_ref->dataset_rec->counters[H5D_RW_SWITCHES], rec_ref->dataset_rec->counters[H5D_FLUSHES], tm1, tm2, rec_ref->dataset_rec->fcounters[H5D_F_WRITE_TIME], "H5D", "MOD"); + } } - } #endif } H5D_POST_RECORD(); @@ -1011,12 +1010,12 @@ herr_t DARSHAN_DECL(H5Dclose)(hid_t dataset_id) darshan_delete_record_ref(&(hdf5_dataset_runtime->hid_hash), &dataset_id, sizeof(hid_t)); #ifdef HAVE_LDMS - rec_ref->close_counts++; - /* publish close information for h5f */ - extern struct darshanConnector dC; - if(dC.ldms_lib) - if(dC.hdf5_enable_ldms) - darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->close_counts, "close", -1, -1, -1, -1, rec_ref->dataset_rec->counters[H5D_FLUSHES], tm1, tm2, rec_ref->dataset_rec->fcounters[H5D_F_META_TIME], "H5D", "MOD"); + rec_ref->close_counts++; + /* publish close information for h5d */ + extern struct darshanConnector dC; + if(dC.ldms_lib) + if(dC.hdf5_enable_ldms) + darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->close_counts, "close", -1, -1, -1, -1, rec_ref->dataset_rec->counters[H5D_FLUSHES], tm1, tm2, rec_ref->dataset_rec->fcounters[H5D_F_META_TIME], "H5D", "MOD"); #endif } diff --git a/darshan-runtime/lib/darshan-ldms.c b/darshan-runtime/lib/darshan-ldms.c index 9e04de9cd..6b09edd61 100644 --- a/darshan-runtime/lib/darshan-ldms.c +++ b/darshan-runtime/lib/darshan-ldms.c @@ -1,6 +1,6 @@ /* - * Copyright (C) 2016 Intel Corporation. - * See COPYRIGHT notice in top-level directory. + * Copyright (C) 2019 University of Chicago. + * See COPYRIGHT notice in top-level directory. * */ @@ -57,7 +57,6 @@ static void event_cb(ldms_t x, ldms_xprt_event_t e, void *cb_arg) ldms_t setup_connection(const char *xprt, const char *host, const char *port, const char *auth) { - char hostname[PATH_MAX]; const char *timeout = "5"; int rc; struct timespec ts; @@ -114,8 +113,8 @@ void darshan_ldms_connector_initialize(struct darshan_core_runtime *init_core) else if (getenv("LOAD_STEP_ID")) dC.jobid = atoi(getenv("LOAD_STEP_ID")); else - /* grab jobid from darshan_core_runtime if slurm, lsf, sge or loadleveler do not exist*/ - dC.jobid = init_core->log_job_p->jobid; + /* grab jobid from darshan_core_runtime if slurm, lsf, sge or loadleveler do not exist*/ + dC.jobid = init_core->log_job_p->jobid; /* grab exe path from darshan_core_runtime. Save with a tmp that will be used later*/ dC.exepath = strtok(init_core->log_exemnt_p, " "); @@ -169,16 +168,16 @@ void darshan_ldms_connector_initialize(struct darshan_core_runtime *init_core) pthread_mutex_lock(&dC.ln_lock); dC.ldms_darsh = setup_connection(env_ldms_xprt, env_ldms_host, env_ldms_port, env_ldms_auth); - if (dC.conn_status != 0) { - darshan_core_fprintf(stderr, "LDMS library: darshanConnector error %i setting up connection to LDMS streams daemon -- exiting.\n", dC.conn_status); - pthread_mutex_unlock(&dC.ln_lock); - return; - } - else if (dC.ldms_darsh->disconnected){ - darshan_core_fprintf(stderr, "LDMS library: darshanConnector disconnected from LDMS streams daemon -- exiting.\n"); - pthread_mutex_unlock(&dC.ln_lock); - return; - } + if (dC.conn_status != 0) { + darshan_core_fprintf(stderr, "LDMS library: darshanConnector error %i setting up connection to LDMS streams daemon -- exiting.\n", dC.conn_status); + pthread_mutex_unlock(&dC.ln_lock); + return; + } + else if (dC.ldms_darsh->disconnected){ + darshan_core_fprintf(stderr, "LDMS library: darshanConnector disconnected from LDMS streams daemon -- exiting.\n"); + pthread_mutex_unlock(&dC.ln_lock); + return; + } pthread_mutex_unlock(&dC.ln_lock); return; } diff --git a/darshan-runtime/lib/darshan-ldms.h b/darshan-runtime/lib/darshan-ldms.h index 9ee752310..76a37f8f9 100644 --- a/darshan-runtime/lib/darshan-ldms.h +++ b/darshan-runtime/lib/darshan-ldms.h @@ -37,8 +37,6 @@ typedef struct darshanConnector { int64_t write_count; int conn_status; struct timespec ts; - uint64_t *record_id; - int64_t *record_count; pthread_mutex_t ln_lock; ldms_t ldms_darsh; ldms_t ldms_g; @@ -68,10 +66,6 @@ typedef struct darshanConnector { * specified module from the set environment variables (i.e. *MODULENAME*_ENABLE_LDMS) * to LDMSD streams plugin. * - * LDMS related function to retrieve and set the meta data of each Darshan - * run (i.e. record id, rank, etc.). These values will not be updated unless a different module - * is detected or a new run is executed. - * */ void darshan_ldms_connector_initialize(struct darshan_core_runtime *); diff --git a/darshan-runtime/lib/darshan-mpiio.c b/darshan-runtime/lib/darshan-mpiio.c index b22585601..85e84286f 100644 --- a/darshan-runtime/lib/darshan-mpiio.c +++ b/darshan-runtime/lib/darshan-mpiio.c @@ -195,7 +195,7 @@ static int my_rank = -1; #define MPIIO_UNLOCK() pthread_mutex_unlock(&mpiio_runtime_mutex) #define MPIIO_WTIME() \ - __darshan_disabled ? 0 : darshan_core_wtime(); \ + __darshan_disabled ? 0 : darshan_core_wtime(); /* note that if the break condition is triggered in this macro, then it * will exit the do/while loop holding a lock that will be released in @@ -222,7 +222,6 @@ static int my_rank = -1; struct mpiio_file_record_ref *rec_ref; \ char *newpath; \ int comm_size; \ - extern struct darshanConnector dC; \ if(__ret != MPI_SUCCESS) break; \ newpath = darshan_clean_file_path(__path); \ if(!newpath) newpath = (char *)__path; \ @@ -249,10 +248,11 @@ static int my_rank = -1; __tm1, __tm2, rec_ref->last_meta_end); \ darshan_add_record_ref(&(mpiio_runtime->fh_hash), &__fh, sizeof(MPI_File), rec_ref); \ if(newpath != __path) free(newpath); \ - /* LDMS to publish realtime read tracing information to daemon*/ \ + /* LDMS to publish realtime open tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.mpiio_enable_ldms)\ - darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->file_rec->counters[MPIIO_COLL_OPENS] + rec_ref->file_rec->counters[MPIIO_INDEP_OPENS], "open", -1, -1, -1, -1, -1, __tm1, __tm2, rec_ref->file_rec->fcounters[MPIIO_F_META_TIME], "MPIIO", "MET");\ + darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->file_rec->counters[MPIIO_COLL_OPENS] + rec_ref->file_rec->counters[MPIIO_INDEP_OPENS], "open", -1, -1, -1, -1, -1, __tm1, __tm2, rec_ref->file_rec->fcounters[MPIIO_F_META_TIME], "MPIIO", "MET");\ } while(0) /* XXX: this check is needed to work around an OpenMPI bug that is triggered by @@ -272,7 +272,6 @@ static int get_byte_offset = 0; int64_t size_ll; \ struct darshan_common_val_counter *cvc; \ double __elapsed = __tm2-__tm1; \ - extern struct darshanConnector dC; \ if(__ret != MPI_SUCCESS) break; \ rec_ref = darshan_lookup_record_ref(mpiio_runtime->fh_hash, &(__fh), sizeof(MPI_File)); \ if(!rec_ref) break; \ @@ -308,6 +307,7 @@ static int get_byte_offset = 0; DARSHAN_TIMER_INC_NO_OVERLAP(rec_ref->file_rec->fcounters[MPIIO_F_READ_TIME], \ __tm1, __tm2, rec_ref->last_read_end); \ /* LDMS to publish realtime read tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.mpiio_enable_ldms)\ darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->file_rec->counters[__counter], "read", displacement, size, -1, rec_ref->file_rec->counters[MPIIO_RW_SWITCHES], -1, __tm1, __tm2, rec_ref->file_rec->fcounters[MPIIO_F_READ_TIME], "MPIIO", "MOD");\ @@ -320,7 +320,6 @@ static int get_byte_offset = 0; int64_t size_ll; \ struct darshan_common_val_counter *cvc; \ double __elapsed = __tm2-__tm1; \ - extern struct darshanConnector dC; \ if(__ret != MPI_SUCCESS) break; \ rec_ref = darshan_lookup_record_ref(mpiio_runtime->fh_hash, &(__fh), sizeof(MPI_File)); \ if(!rec_ref) break; \ @@ -355,7 +354,8 @@ static int get_byte_offset = 0; rec_ref->file_rec->counters[MPIIO_MAX_WRITE_TIME_SIZE] = size; } \ DARSHAN_TIMER_INC_NO_OVERLAP(rec_ref->file_rec->fcounters[MPIIO_F_WRITE_TIME], \ __tm1, __tm2, rec_ref->last_write_end); \ - /* LDMS to publish realtime read tracing information to daemon*/ \ + /* LDMS to publish realtime write tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.mpiio_enable_ldms)\ darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->file_rec->counters[__counter], "write", displacement, size, -1, rec_ref->file_rec->counters[MPIIO_RW_SWITCHES], -1, __tm1, __tm2, rec_ref->file_rec->fcounters[MPIIO_F_WRITE_TIME], "MPIIO", "MOD");\ @@ -375,6 +375,7 @@ int DARSHAN_DECL(MPI_File_open)(MPI_Comm comm, char *filename, int amode, MPI_In MPI_File tmp_fh; char* tmp; double tm1, tm2; + MAP_OR_FAIL(PMPI_File_open); tm1 = MPIIO_WTIME(); @@ -409,7 +410,6 @@ int DARSHAN_DECL(MPI_File_read)(MPI_File fh, void *buf, int count, { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_read); @@ -438,7 +438,6 @@ int DARSHAN_DECL(MPI_File_write)(MPI_File fh, void *buf, int count, { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_write); @@ -520,7 +519,6 @@ int DARSHAN_DECL(MPI_File_read_all)(MPI_File fh, void * buf, int count, MPI_Data { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_read_all); @@ -548,7 +546,6 @@ int DARSHAN_DECL(MPI_File_write_all)(MPI_File fh, void * buf, int count, MPI_Dat { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_write_all); @@ -634,7 +631,6 @@ int DARSHAN_DECL(MPI_File_read_shared)(MPI_File fh, void * buf, int count, MPI_D { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_read_shared); @@ -662,7 +658,6 @@ int DARSHAN_DECL(MPI_File_write_shared)(MPI_File fh, void * buf, int count, MPI_ { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_write_shared); @@ -693,7 +688,6 @@ int DARSHAN_DECL(MPI_File_read_ordered)(MPI_File fh, void * buf, int count, { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_read_ordered); @@ -724,7 +718,6 @@ int DARSHAN_DECL(MPI_File_write_ordered)(MPI_File fh, void * buf, int count, { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_write_ordered); @@ -755,7 +748,6 @@ int DARSHAN_DECL(MPI_File_read_all_begin)(MPI_File fh, void * buf, int count, MP { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_read_all_begin); @@ -782,7 +774,6 @@ int DARSHAN_DECL(MPI_File_write_all_begin)(MPI_File fh, void * buf, int count, M { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_write_all_begin); @@ -865,7 +856,6 @@ int DARSHAN_DECL(MPI_File_read_ordered_begin)(MPI_File fh, void * buf, int count { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_read_ordered_begin); @@ -893,7 +883,6 @@ int DARSHAN_DECL(MPI_File_write_ordered_begin)(MPI_File fh, void * buf, int coun { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_write_ordered_begin); @@ -922,7 +911,6 @@ int DARSHAN_DECL(MPI_File_iread)(MPI_File fh, void * buf, int count, MPI_Datatyp { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_iread); @@ -951,7 +939,6 @@ int DARSHAN_DECL(MPI_File_iwrite)(MPI_File fh, void * buf, int count, { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_iwrite); @@ -1039,7 +1026,6 @@ int DARSHAN_DECL(MPI_File_iread_shared)(MPI_File fh, void * buf, int count, { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_iread_shared); @@ -1070,7 +1056,6 @@ int DARSHAN_DECL(MPI_File_iwrite_shared)(MPI_File fh, void * buf, int count, { int ret; double tm1, tm2; - MPI_Offset offset; MAP_OR_FAIL(PMPI_File_iwrite_shared); @@ -1205,12 +1190,12 @@ int DARSHAN_DECL(MPI_File_close)(MPI_File *fh) &tmp_fh, sizeof(MPI_File)); #ifdef HAVE_LDMS - rec_ref->close_counts++; - /* publish close information for mpiio */ - extern struct darshanConnector dC; - if(dC.ldms_lib) - if(dC.mpiio_enable_ldms) - darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->close_counts, "close", -1, -1, -1, -1, -1, tm1, tm2, rec_ref->file_rec->fcounters[MPIIO_F_META_TIME], "MPIIO", "MOD"); + rec_ref->close_counts++; + /* publish close information for mpiio */ + extern struct darshanConnector dC; + if(dC.ldms_lib) + if(dC.mpiio_enable_ldms) + darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->close_counts, "close", -1, -1, -1, -1, -1, tm1, tm2, rec_ref->file_rec->fcounters[MPIIO_F_META_TIME], "MPIIO", "MOD"); #endif } diff --git a/darshan-runtime/lib/darshan-posix.c b/darshan-runtime/lib/darshan-posix.c index 2cf101120..dad114610 100644 --- a/darshan-runtime/lib/darshan-posix.c +++ b/darshan-runtime/lib/darshan-posix.c @@ -211,7 +211,7 @@ static int darshan_mem_alignment = 1; #define POSIX_UNLOCK() pthread_mutex_unlock(&posix_runtime_mutex) #define POSIX_WTIME() \ - __darshan_disabled ? 0 : darshan_core_wtime();\ + __darshan_disabled ? 0 : darshan_core_wtime(); /* note that if the break condition is triggered in this macro, then it * will exit the do/while loop holding a lock that will be released in @@ -237,7 +237,6 @@ static int darshan_mem_alignment = 1; darshan_record_id __rec_id; \ struct posix_file_record_ref *__rec_ref; \ char *__newpath; \ - extern struct darshanConnector dC; \ if(__ret < 0) break; \ __newpath = darshan_clean_file_path(__path); \ if(!__newpath) __newpath = (char *)__path; \ @@ -251,10 +250,11 @@ static int darshan_mem_alignment = 1; _POSIX_RECORD_OPEN(__ret, __rec_ref, __mode, __tm1, __tm2, 1, -1); \ darshan_instrument_fs_data(__rec_ref->fs_type, __newpath, __ret); \ if(__newpath != __path) free(__newpath); \ - /* LDMS to publish realtime read tracing information to daemon*/ \ + /* LDMS to publish realtime open tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.posix_enable_ldms)\ - darshan_ldms_connector_send(__rec_ref->file_rec->base_rec.id, __rec_ref->file_rec->base_rec.rank, __rec_ref->file_rec->counters[POSIX_OPENS], "open", -1, -1, -1, -1, -1, __tm1, __tm2, __rec_ref->file_rec->fcounters[POSIX_F_META_TIME], "POSIX", "MET");\ + darshan_ldms_connector_send(__rec_ref->file_rec->base_rec.id, __rec_ref->file_rec->base_rec.rank, __rec_ref->file_rec->counters[POSIX_OPENS], "open", -1, -1, -1, -1, -1, __tm1, __tm2, __rec_ref->file_rec->fcounters[POSIX_F_META_TIME], "POSIX", "MET");\ } while(0) #define POSIX_RECORD_REFOPEN(__ret, __rec_ref, __tm1, __tm2, __ref_counter) do { \ @@ -287,7 +287,6 @@ static int darshan_mem_alignment = 1; int64_t file_alignment; \ struct darshan_common_val_counter *cvc; \ double __elapsed = __tm2-__tm1; \ - extern struct darshanConnector dC; \ if(__ret < 0) break; \ rec_ref = darshan_lookup_record_ref(posix_runtime->fd_hash, &(__fd), sizeof(int)); \ if(!rec_ref) break; \ @@ -345,9 +344,10 @@ static int darshan_mem_alignment = 1; DARSHAN_TIMER_INC_NO_OVERLAP(rec_ref->file_rec->fcounters[POSIX_F_READ_TIME], \ __tm1, __tm2, rec_ref->last_read_end); \ /* LDMS to publish realtime read tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.posix_enable_ldms)\ - darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->file_rec->counters[POSIX_READS], "read", this_offset, __ret, rec_ref->file_rec->counters[POSIX_MAX_BYTE_READ],rec_ref->file_rec->counters[POSIX_RW_SWITCHES], -1, __tm1, __tm2, rec_ref->file_rec->fcounters[POSIX_F_READ_TIME], "POSIX", "MOD");\ + darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->file_rec->counters[POSIX_READS], "read", this_offset, __ret, rec_ref->file_rec->counters[POSIX_MAX_BYTE_READ],rec_ref->file_rec->counters[POSIX_RW_SWITCHES], -1, __tm1, __tm2, rec_ref->file_rec->fcounters[POSIX_F_READ_TIME], "POSIX", "MOD");\ } while(0) #define POSIX_RECORD_WRITE(__ret, __fd, __pwrite_flag, __pwrite_offset, __aligned, __tm1, __tm2) do { \ @@ -357,7 +357,6 @@ static int darshan_mem_alignment = 1; int64_t file_alignment; \ struct darshan_common_val_counter *cvc; \ double __elapsed = __tm2-__tm1; \ - extern struct darshanConnector dC; \ if(__ret < 0) break; \ rec_ref = darshan_lookup_record_ref(posix_runtime->fd_hash, &__fd, sizeof(int)); \ if(!rec_ref) break; \ @@ -415,6 +414,7 @@ static int darshan_mem_alignment = 1; DARSHAN_TIMER_INC_NO_OVERLAP(rec_ref->file_rec->fcounters[POSIX_F_WRITE_TIME], \ __tm1, __tm2, rec_ref->last_write_end); \ /* LDMS to publish realtime write tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.posix_enable_ldms)\ darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->file_rec->counters[POSIX_WRITES], "write", this_offset, __ret, rec_ref->file_rec->counters[POSIX_MAX_BYTE_WRITTEN], rec_ref->file_rec->counters[POSIX_RW_SWITCHES], -1, __tm1, __tm2, rec_ref->file_rec->fcounters[POSIX_F_WRITE_TIME], "POSIX", "MOD");\ diff --git a/darshan-runtime/lib/darshan-stdio.c b/darshan-runtime/lib/darshan-stdio.c index 18612bc11..9a5298b4f 100644 --- a/darshan-runtime/lib/darshan-stdio.c +++ b/darshan-runtime/lib/darshan-stdio.c @@ -87,7 +87,6 @@ #include "darshan.h" #include "darshan-dynamic.h" #include "darshan-heatmap.h" -#include "darshan-dxt.h" #include "darshan-ldms.h" #ifndef HAVE_OFF64_T @@ -218,7 +217,6 @@ extern int __real_fileno(FILE *stream); #define STDIO_RECORD_OPEN(__ret, __path, __tm1, __tm2) do { \ darshan_record_id __rec_id; \ struct stdio_file_record_ref *__rec_ref; \ - extern struct darshanConnector dC; \ char *__newpath; \ int __fd; \ MAP_OR_FAIL(fileno); \ @@ -237,7 +235,8 @@ extern int __real_fileno(FILE *stream); __fd = __real_fileno(__ret); \ darshan_instrument_fs_data(__rec_ref->fs_type, __newpath, __fd); \ if(__newpath != (char*)__path) free(__newpath); \ - /* LDMS to publish realtime read tracing information to daemon*/ \ + /* LDMS to publish realtime open tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.stdio_enable_ldms)\ darshan_ldms_connector_send(__rec_ref->file_rec->base_rec.id, __rec_ref->file_rec->base_rec.rank,__rec_ref->file_rec->counters[STDIO_OPENS], "open", -1, -1, -1, -1, -1, __tm1, __tm2, __rec_ref->file_rec->fcounters[STDIO_F_META_TIME], "STDIO", "MET");\ @@ -245,7 +244,7 @@ extern int __real_fileno(FILE *stream); #define STDIO_RECORD_REFOPEN(__ret, __rec_ref, __tm1, __tm2, __ref_counter) do { \ if(!ret || !rec_ref) break; \ - _STDIO_RECORD_OPEN(__ret, __rec_ref, __tm1, __tm2, 0, __ref_counter); \ + _STDIO_RECORD_OPEN(__ret, __rec_ref, __tm1, __tm2, 0, __ref_counter); \ } while(0) #define _STDIO_RECORD_OPEN(__ret, __rec_ref, __tm1, __tm2, __reset_flag, __ref_counter) do { \ @@ -264,7 +263,6 @@ extern int __real_fileno(FILE *stream); #define STDIO_RECORD_READ(__fp, __bytes, __tm1, __tm2) do{ \ struct stdio_file_record_ref* rec_ref; \ int64_t this_offset; \ - extern struct darshanConnector dC; \ rec_ref = darshan_lookup_record_ref(stdio_runtime->stream_hash, &(__fp), sizeof(__fp)); \ if(!rec_ref) break; \ this_offset = rec_ref->offset; \ @@ -281,6 +279,7 @@ extern int __real_fileno(FILE *stream); rec_ref->file_rec->fcounters[STDIO_F_READ_END_TIMESTAMP] = __tm2; \ DARSHAN_TIMER_INC_NO_OVERLAP(rec_ref->file_rec->fcounters[STDIO_F_READ_TIME], __tm1, __tm2, rec_ref->last_read_end); \ /* LDMS to publish realtime read tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.stdio_enable_ldms) \ darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->file_rec->counters[STDIO_READS], "read", this_offset, __bytes, rec_ref->file_rec->counters[STDIO_MAX_BYTE_READ], -1, -1, __tm1, __tm2, rec_ref->file_rec->fcounters[STDIO_F_READ_TIME],"STDIO", "MOD"); \ @@ -289,7 +288,6 @@ extern int __real_fileno(FILE *stream); #define STDIO_RECORD_WRITE(__fp, __bytes, __tm1, __tm2, __fflush_flag) do{ \ struct stdio_file_record_ref* rec_ref; \ int64_t this_offset; \ - extern struct darshanConnector dC; \ rec_ref = darshan_lookup_record_ref(stdio_runtime->stream_hash, &(__fp), sizeof(__fp)); \ if(!rec_ref) break; \ this_offset = rec_ref->offset; \ @@ -308,6 +306,8 @@ extern int __real_fileno(FILE *stream); rec_ref->file_rec->fcounters[STDIO_F_WRITE_START_TIMESTAMP] = __tm1; \ rec_ref->file_rec->fcounters[STDIO_F_WRITE_END_TIMESTAMP] = __tm2; \ DARSHAN_TIMER_INC_NO_OVERLAP(rec_ref->file_rec->fcounters[STDIO_F_WRITE_TIME], __tm1, __tm2, rec_ref->last_write_end); \ + /* LDMS to publish realtime write tracing information to daemon*/ \ + extern struct darshanConnector dC; \ if(dC.ldms_lib)\ if(dC.stdio_enable_ldms)\ darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->file_rec->counters[STDIO_WRITES], "write", this_offset, __bytes, rec_ref->file_rec->counters[STDIO_MAX_BYTE_WRITTEN], -1, rec_ref->file_rec->counters[STDIO_FLUSHES], __tm1, __tm2, rec_ref->file_rec->fcounters[STDIO_F_WRITE_TIME], "STDIO", "MOD"); \ @@ -465,12 +465,12 @@ int DARSHAN_DECL(fclose)(FILE *fp) darshan_delete_record_ref(&(stdio_runtime->stream_hash), &fp, sizeof(fp)); #ifdef HAVE_LDMS - rec_ref->close_counts++; - /* publish close information for stdio */ - extern struct darshanConnector dC; - if(dC.ldms_lib) - if(dC.stdio_enable_ldms) - darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->close_counts, "close", -1, -1, -1, -1, rec_ref->file_rec->counters[STDIO_FLUSHES], tm1, tm2, rec_ref->file_rec->fcounters[STDIO_F_META_TIME], "STDIO", "MOD"); + rec_ref->close_counts++; + /* publish close information for stdio */ + extern struct darshanConnector dC; + if(dC.ldms_lib) + if(dC.stdio_enable_ldms) + darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, rec_ref->close_counts, "close", -1, -1, -1, -1, rec_ref->file_rec->counters[STDIO_FLUSHES], tm1, tm2, rec_ref->file_rec->fcounters[STDIO_F_META_TIME], "STDIO", "MOD"); #endif } diff --git a/darshan-runtime/lib/darshan.h b/darshan-runtime/lib/darshan.h index 050629231..c1ac2215b 100644 --- a/darshan-runtime/lib/darshan.h +++ b/darshan-runtime/lib/darshan.h @@ -410,7 +410,6 @@ static inline double darshan_core_wtime_absolute(void) * - it is not well defined how much precision will be sacrificed */ clock_gettime(CLOCK_REALTIME, &tp); - return(((double)tp.tv_sec) + 1.0e-9 * ((double)tp.tv_nsec)); #endif }