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)
return 0;
}
int nrm_send_phase_context(struct nrm_context *ctxt, int cpu, unsigned long
long int startCompute, unsigned long long int endCompute, unsigned
long long int startBarrier, unsigned long long int endBarrier)
int nrm_send_phase_context(struct nrm_context *ctxt, unsigned int cpu, unsigned
int aggregation, unsigned long long int computeTime, unsigned long long int
totalTime)
{
char buf[512];
struct timespec now;
......@@ -83,8 +83,8 @@ int nrm_send_phase_context(struct nrm_context *ctxt, int cpu, unsigned long
if(timediff > NRM_RATELIMIT_THRESHOLD)
{
snprintf(buf, 512, NRM_PHASE_CONTEXT_FORMAT, cpu, startCompute,
endCompute, startBarrier, endBarrier, ctxt->app_uuid);
snprintf(buf, 512, NRM_PHASE_CONTEXT_FORMAT, cpu, aggregation,
computeTime, totalTime, ctxt->app_uuid);
int err = zmq_send(ctxt->socket, buf, strnlen(buf, 512), 0);
assert(err > 0);
}
......
......@@ -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_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\"}"
#ifdef __cplusplus
extern "C"{
......@@ -38,9 +38,9 @@ int nrm_init(struct nrm_context *, const char *);
int nrm_fini(struct nrm_context *);
int nrm_send_progress(struct nrm_context *, unsigned long);
int nrm_send_phase_context(struct nrm_context *ctxt, int cpu, unsigned long
long int startCompute, unsigned long long int endCompute, unsigned
long long int startBarrier, unsigned long long int endBarrier);
int nrm_send_phase_context(struct nrm_context *ctxt, unsigned int cpu, unsigned
int aggregation, unsigned long long int computeTime, unsigned long long int
totalTime);
#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