Commit 2970011f authored by Sridutt Bhalachandra's avatar Sridutt Bhalachandra

[Feature] downstream API supports aggregation

Instead of transmitting clock times, the downstream API is changed to
allow application side aggregation of phases below a damper value. This
is to decrease the frequency of messages sent.

The downstream API will now transmit the actual time a CPU spent in
computation and the total phase time.

See Issue #2
parent dba21726
...@@ -71,9 +71,9 @@ int nrm_send_progress(struct nrm_context *ctxt, unsigned long progress) ...@@ -71,9 +71,9 @@ int nrm_send_progress(struct nrm_context *ctxt, unsigned long progress)
return 0; return 0;
} }
int nrm_send_phase_context(struct nrm_context *ctxt, int cpu, unsigned long int nrm_send_phase_context(struct nrm_context *ctxt, unsigned int cpu, unsigned
long int startCompute, unsigned long long int endCompute, unsigned int aggregation, unsigned long long int computeTime, unsigned long long int
long long int startBarrier, unsigned long long int endBarrier) totalTime)
{ {
char buf[512]; char buf[512];
struct timespec now; struct timespec now;
...@@ -83,8 +83,8 @@ int nrm_send_phase_context(struct nrm_context *ctxt, int cpu, unsigned long ...@@ -83,8 +83,8 @@ int nrm_send_phase_context(struct nrm_context *ctxt, int cpu, unsigned long
if(timediff > NRM_RATELIMIT_THRESHOLD) if(timediff > NRM_RATELIMIT_THRESHOLD)
{ {
snprintf(buf, 512, NRM_PHASE_CONTEXT_FORMAT, cpu, startCompute, snprintf(buf, 512, NRM_PHASE_CONTEXT_FORMAT, cpu, aggregation,
endCompute, startBarrier, endBarrier, ctxt->app_uuid); computeTime, totalTime, ctxt->app_uuid);
int err = zmq_send(ctxt->socket, buf, strnlen(buf, 512), 0); int err = zmq_send(ctxt->socket, buf, strnlen(buf, 512), 0);
assert(err > 0); assert(err > 0);
} }
......
...@@ -28,7 +28,7 @@ struct nrm_context { ...@@ -28,7 +28,7 @@ struct nrm_context {
#define NRM_START_FORMAT "{\"type\":\"application\", \"event\":\"start\", \"container\": \"%s\", \"uuid\": \"%s\", \"progress\": true, \"threads\": null}" #define NRM_START_FORMAT "{\"type\":\"application\", \"event\":\"start\", \"container\": \"%s\", \"uuid\": \"%s\", \"progress\": true, \"threads\": null}"
#define NRM_PROGRESS_FORMAT "{\"type\":\"application\", \"event\":\"progress\", \"payload\": \"%lu\", \"uuid\": \"%s\"}" #define NRM_PROGRESS_FORMAT "{\"type\":\"application\", \"event\":\"progress\", \"payload\": \"%lu\", \"uuid\": \"%s\"}"
#define NRM_PHASE_CONTEXT_FORMAT "{\"type\":\"application\", \"event\":\"phase_context\", \"cpu\": \"%d\", \"startcompute\": \"%llu\", \"endcompute\": \"%llu\", \"startbarrier\": \"%llu\", \"endbarrier\": \"%llu\", \"uuid\": \"%s\"}" #define NRM_PHASE_CONTEXT_FORMAT "{\"type\":\"application\", \"event\":\"phase_context\", \"cpu\": \"%u\", \"aggregation\": \"%u\", \"computetime\": \"%llu\", \"totaltime\": \"%llu\", \"uuid\": \"%s\"}"
#define NRM_EXIT_FORMAT "{\"type\":\"application\", \"event\":\"exit\", \"uuid\": \"%s\"}" #define NRM_EXIT_FORMAT "{\"type\":\"application\", \"event\":\"exit\", \"uuid\": \"%s\"}"
#ifdef __cplusplus #ifdef __cplusplus
extern "C"{ extern "C"{
...@@ -38,9 +38,9 @@ int nrm_init(struct nrm_context *, const char *); ...@@ -38,9 +38,9 @@ int nrm_init(struct nrm_context *, const char *);
int nrm_fini(struct nrm_context *); int nrm_fini(struct nrm_context *);
int nrm_send_progress(struct nrm_context *, unsigned long); int nrm_send_progress(struct nrm_context *, unsigned long);
int nrm_send_phase_context(struct nrm_context *ctxt, int cpu, unsigned long int nrm_send_phase_context(struct nrm_context *ctxt, unsigned int cpu, unsigned
long int startCompute, unsigned long long int endCompute, unsigned int aggregation, unsigned long long int computeTime, unsigned long long int
long long int startBarrier, unsigned long long int endBarrier); totalTime);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
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