MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / latencyCommandReplyWithSamples

Function latencyCommandReplyWithSamples

src/latency.cpp:495–509  ·  view source on GitHub ↗

latencyCommand() helper to produce a time-delay reply for all the samples * in memory for the specified time series. */

Source from the content-addressed store, hash-verified

493/* latencyCommand() helper to produce a time-delay reply for all the samples
494 * in memory for the specified time series. */
495void latencyCommandReplyWithSamples(client *c, struct latencyTimeSeries *ts) {
496 void *replylen = addReplyDeferredLen(c);
497 int samples = 0, j;
498
499 for (j = 0; j < LATENCY_TS_LEN; j++) {
500 int i = (ts->idx + j) % LATENCY_TS_LEN;
501
502 if (ts->samples[i].time == 0) continue;
503 addReplyArrayLen(c,2);
504 addReplyLongLong(c,ts->samples[i].time);
505 addReplyLongLong(c,ts->samples[i].latency);
506 samples++;
507 }
508 setDeferredArrayLen(c,replylen,samples);
509}
510
511/* latencyCommand() helper to produce the reply for the LATEST subcommand,
512 * listing the last latency sample for every event type registered so far. */

Callers 1

latencyCommandFunction · 0.85

Calls 4

addReplyDeferredLenFunction · 0.85
addReplyArrayLenFunction · 0.85
addReplyLongLongFunction · 0.85
setDeferredArrayLenFunction · 0.85

Tested by

no test coverage detected