Skip to content

Commit

Permalink
Adding PVAR for backfill queue size
Browse files Browse the repository at this point in the history
  • Loading branch information
srini009 committed Jun 30, 2020
1 parent 7060882 commit c8d73b9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "Testing/driver/kwsys"]
path = Testing/driver/kwsys
url = https://github.com/mercury-hpc/kwsys.git
[submodule "src/mchecksum"]
path = src/mchecksum
url = https://github.com/mercury-hpc/mchecksum.git
[submodule "src/boost"]
path = src/boost
url = https://github.com/mercury-hpc/preprocessor.git
1 change: 0 additions & 1 deletion src/mchecksum
Submodule mchecksum deleted from 3c76b3
7 changes: 7 additions & 0 deletions src/mercury_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include "mercury_time.h"
#include "mercury_error.h"

/* PVAR profiling support */
#include "mercury_prof_pvar_impl.h"

#ifdef HG_HAS_SM_ROUTING
#include <uuid/uuid.h>
#endif
Expand Down Expand Up @@ -3153,9 +3156,13 @@ hg_core_trigger(struct hg_core_private_context *context, unsigned int timeout,
unsigned int count = 0;
hg_return_t ret = HG_SUCCESS;

HG_PROF_PVAR_UINT_COUNTER(hg_pvar_hg_backfill_queue_count);
while (count < max_count) {
struct hg_completion_entry *hg_completion_entry = NULL;

/* Set value of PVAR */
HG_PROF_PVAR_UINT_COUNTER_SET(hg_pvar_hg_backfill_queue_count, hg_atomic_get32(&context->backfill_queue_count));

hg_completion_entry =
hg_atomic_queue_pop_mc(context->completion_queue);
if (!hg_completion_entry) {
Expand Down
1 change: 1 addition & 0 deletions src/mercury_prof_pvar_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ hg_prof_pvar_init() {
/*Initialize internal PVAR data structures*/
pvar_table = hg_hash_table_new(hg_prof_uint_hash, hg_prof_uint_equal);
/* Register available PVARs */
HG_PROF_PVAR_UINT_COUNTER_REGISTER(HG_UINT, HG_PROF_BIND_NO_OBJECT, hg_pvar_hg_backfill_queue_count, "Backfill queue size");
HG_PROF_PVAR_UINT_COUNTER_REGISTER(HG_UINT, HG_PROF_BIND_NO_OBJECT, hg_pvar_hg_forward_count, "Number of times HG_Forward has been invoked");
HG_PROF_PVAR_DOUBLE_COUNTER_REGISTER(HG_DOUBLE, HG_PROF_BIND_NO_OBJECT, hg_pvar_hg_input_serial_time, "Time taken to serialize input (s)");
HG_PROF_PVAR_DOUBLE_COUNTER_REGISTER(HG_DOUBLE, HG_PROF_BIND_NO_OBJECT, hg_pvar_hg_input_deserial_time, "Time taken to de-serialize input (s)");
Expand Down
8 changes: 6 additions & 2 deletions src/mercury_prof_pvar_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ typedef struct hg_prof_pvar_data_t hg_prof_pvar_data_t;
/* Public Macros */
/*****************/

#define NUM_PVARS 5 /* Number of PVARs currently exported. PVAR indices go from 0......(NUM_PVARS - 1). */
#define NUM_PVARS 6 /* Number of PVARs currently exported. PVAR indices go from 0......(NUM_PVARS - 1). */

/* PVAR handle declaration and registration macros */
#define HG_PROF_PVAR_UINT_COUNTER(name) \
Expand All @@ -63,7 +63,7 @@ typedef struct hg_prof_pvar_data_t hg_prof_pvar_data_t;
HG_PROF_PVAR_REGISTER_impl(HG_PVAR_CLASS_COUNTER, dtype, #name, \
(void *)addr_##name, 1, bind, 1, desc);

/* Increment the value of a PVAR */
/* Change the value of a PVAR */
#define HG_PROF_PVAR_UINT_COUNTER_INC(name, val) \
addr_##name = (addr_##name == NULL ? hg_prof_get_pvar_addr_from_name(#name): addr_##name); \
for(int i=0; i < val; i++) \
Expand All @@ -73,6 +73,10 @@ typedef struct hg_prof_pvar_data_t hg_prof_pvar_data_t;
addr_##name = (addr_##name == NULL ? hg_prof_get_pvar_addr_from_name(#name): addr_##name); \
*(addr_##name) += val;

#define HG_PROF_PVAR_UINT_COUNTER_SET(name, val) \
addr_##name = (addr_##name == NULL ? hg_prof_get_pvar_addr_from_name(#name): addr_##name); \
hg_atomic_set32(addr_##name, val);

/**
* Internal routine that gets invoked during Mercury's own initialization routine.
* General routine for initializing the PVAR data structures and registering any PVARs that are not bound to a specific module.
Expand Down

0 comments on commit c8d73b9

Please sign in to comment.