Commit 81337644 authored by Philip Carns's avatar Philip Carns

add ability to set and query timeout upper bound

parent c34e5501
......@@ -32,6 +32,8 @@ typedef struct margo_data* margo_data_ptr;
#define MARGO_DEFAULT_MPLEX_ID 0
#define MARGO_RPC_ID_IGNORE ((hg_id_t*)NULL)
#define MARGO_INFO_PROGRESS_TIMEOUT_UB 1
/**
* Initializes margo library.
* @param [in] use_progress_thread Boolean flag to use a dedicated thread for
......@@ -276,6 +278,27 @@ void margo_diag_start(margo_instance_id mid);
*/
void margo_diag_dump(margo_instance_id mid, const char* file, int uniquify);
/**
* Sets configurable parameters/hints
*
* @param [in] mid Margo instance
* @param [in] option numerical option number
* @param [out] inout_param used to pass in values
* @returns void
*/
void margo_set_info(margo_instance_id mid, int option, const void *param);
/**
* Retrieves configurable parameters/hints
*
* @param [in] mid Margo instance
* @param [in] option numerical option number
* @param [out] param used to pass out values
* @returns void
*/
void margo_get_info(margo_instance_id mid, int option, void *param);
/**
* macro that registers a function as an RPC.
*/
......
......@@ -18,7 +18,7 @@
#include "utlist.h"
#include "uthash.h"
#define MERCURY_PROGRESS_TIMEOUT_UB 100 /* 100 milliseconds */
#define DEFAULT_MERCURY_PROGRESS_TIMEOUT_UB 100 /* 100 milliseconds */
struct mplex_key
{
......@@ -64,6 +64,7 @@ struct margo_instance
int owns_progress_pool;
ABT_xstream *rpc_xstreams;
int num_handler_pool_threads;
unsigned int hg_progress_timeout_ub;
/* control logic for callers waiting on margo to be finalized */
int finalize_flag;
......@@ -163,6 +164,7 @@ margo_instance_id margo_init(int use_progress_thread, int rpc_thread_count,
mid->progress_xstream = progress_xstream;
mid->num_handler_pool_threads = rpc_thread_count < 0 ? 0 : rpc_thread_count;
mid->rpc_xstreams = rpc_xstreams;
mid->hg_progress_timeout_ub = DEFAULT_MERCURY_PROGRESS_TIMEOUT_UB;
return mid;
err:
......@@ -253,7 +255,6 @@ static void margo_cleanup(margo_instance_id mid)
void margo_finalize(margo_instance_id mid)
{
int i;
int do_cleanup;
/* tell progress thread to wrap things up */
......@@ -310,7 +311,7 @@ static void hg_progress_fn(void* foo)
unsigned int actual_count;
struct margo_instance *mid = (struct margo_instance *)foo;
size_t size;
unsigned int hg_progress_timeout = MERCURY_PROGRESS_TIMEOUT_UB;
unsigned int hg_progress_timeout = mid->hg_progress_timeout_ub;
double next_timer_exp;
int trigger_happened;
double tm1, tm2;
......@@ -383,7 +384,7 @@ static void hg_progress_fn(void* foo)
}
else
{
hg_progress_timeout = MERCURY_PROGRESS_TIMEOUT_UB;
hg_progress_timeout = mid->hg_progress_timeout_ub;
ret = margo_timer_get_next_expiration(mid, &next_timer_exp);
if(ret == 0)
{
......@@ -393,7 +394,7 @@ static void hg_progress_fn(void* foo)
if(next_timer_exp >= 0.0)
{
next_timer_exp *= 1000; /* convert to milliseconds */
if(next_timer_exp < MERCURY_PROGRESS_TIMEOUT_UB)
if(next_timer_exp < mid->hg_progress_timeout_ub)
hg_progress_timeout = (unsigned int)next_timer_exp;
}
else
......@@ -954,3 +955,30 @@ void margo_diag_dump(margo_instance_id mid, const char* file, int uniquify)
return;
}
void margo_set_info(margo_instance_id mid, int option, const void *param)
{
switch(option)
{
case MARGO_INFO_PROGRESS_TIMEOUT_UB:
mid->hg_progress_timeout_ub = (*((const unsigned int*)param));
break;
}
return;
}
void margo_get_info(margo_instance_id mid, int option, void *param)
{
switch(option)
{
case MARGO_INFO_PROGRESS_TIMEOUT_UB:
(*((unsigned int*)param)) = mid->hg_progress_timeout_ub;
break;
}
return;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment