From f5ff61de48a561feeb2cd0f08195f771fbe785dc Mon Sep 17 00:00:00 2001 From: Shane Snyder Date: Tue, 14 Jun 2016 14:44:25 -0500 Subject: [PATCH] simplify common counter logic --- darshan-runtime/lib/darshan-common.c | 39 +--------------------------- darshan-runtime/lib/darshan-mpiio.c | 12 --------- darshan-runtime/lib/darshan-posix.c | 16 ------------ 3 files changed, 1 insertion(+), 66 deletions(-) diff --git a/darshan-runtime/lib/darshan-common.c b/darshan-runtime/lib/darshan-common.c index 5522bc2..a13eaf4 100644 --- a/darshan-runtime/lib/darshan-common.c +++ b/darshan-runtime/lib/darshan-common.c @@ -196,29 +196,6 @@ void darshan_record_sort(void *rec_buf, int rec_count, int rec_size) return; } -/* HACK: global variables for determining 4 most common values */ -static int64_t* walker_val_p = NULL; -static int64_t* walker_cnt_p = NULL; - -static void darshan_common_val_walker(const void *nodep, const VISIT which, - const int depth) -{ - struct darshan_common_val_counter* counter; - - switch (which) - { - case postorder: - case leaf: - counter = *(struct darshan_common_val_counter**)nodep; - DARSHAN_COMMON_VAL_COUNTER_INC(walker_val_p, walker_cnt_p, - counter->val, counter->freq, 0); - default: - break; - } - - return; -} - static int darshan_common_val_compare(const void *a_p, const void *b_p) { const struct darshan_common_val_counter* a = a_p; @@ -274,24 +251,10 @@ void darshan_common_val_counter(void **common_val_root, int *common_val_count, (*common_val_count)++; } -#ifdef __DARSHAN_ENABLE_MMAP_LOGS - /* if we are using darshan's mmap feature, update common access - * counters as we go - */ + /* update common access counters as we go */ DARSHAN_COMMON_VAL_COUNTER_INC(common_val_p, common_cnt_p, found->val, found->freq, 1); -#endif - - return; -} - -void darshan_walk_common_vals(void *common_val_root, int64_t *val_p, - int64_t *cnt_p) -{ - walker_val_p = val_p; - walker_cnt_p = cnt_p; - twalk(common_val_root, darshan_common_val_walker); return; } diff --git a/darshan-runtime/lib/darshan-mpiio.c b/darshan-runtime/lib/darshan-mpiio.c index 09c7f94..9042467 100644 --- a/darshan-runtime/lib/darshan-mpiio.c +++ b/darshan-runtime/lib/darshan-mpiio.c @@ -899,19 +899,7 @@ static void mpiio_finalize_file_records(void *rec_ref_p) struct mpiio_file_record_ref *rec_ref = (struct mpiio_file_record_ref *)rec_ref_p; -#ifndef __DARSHAN_ENABLE_MMAP_LOGS - /* walk common counters to get 4 most common -- only if mmap - * feature is disabled (mmap updates counters on the go) - */ - - /* common accesses */ - darshan_walk_common_vals(rec_ref->access_root, - &(rec_ref->file_rec->counters[MPIIO_ACCESS1_ACCESS]), - &(rec_ref->file_rec->counters[MPIIO_ACCESS1_COUNT])); -#endif - tdestroy(rec_ref->access_root, free); - return; } diff --git a/darshan-runtime/lib/darshan-posix.c b/darshan-runtime/lib/darshan-posix.c index bcf780b..f9bc22e 100644 --- a/darshan-runtime/lib/darshan-posix.c +++ b/darshan-runtime/lib/darshan-posix.c @@ -1543,24 +1543,8 @@ static void posix_finalize_file_records(void *rec_ref_p) struct posix_file_record_ref *rec_ref = (struct posix_file_record_ref *)rec_ref_p; -#ifndef __DARSHAN_ENABLE_MMAP_LOGS - /* walk common counters to get 4 most common -- only if mmap - * feature is disabled (mmap updates counters on the go) - */ - - /* common accesses */ - darshan_walk_common_vals(rec_ref->access_root, - &(rec_ref->file_rec->counters[POSIX_ACCESS1_ACCESS]), - &(rec_ref->file_rec->counters[POSIX_ACCESS1_COUNT])); - /* common strides */ - darshan_walk_common_vals(rec_ref->stride_root, - &(rec_ref->file_rec->counters[POSIX_STRIDE1_STRIDE]), - &(rec_ref->file_rec->counters[POSIX_STRIDE1_COUNT])); -#endif - tdestroy(rec_ref->access_root, free); tdestroy(rec_ref->stride_root, free); - return; } -- 2.26.2