latencyCommand() helper to produce a time-delay reply for all the samples * in memory for the specified time series. */
| 493 | /* latencyCommand() helper to produce a time-delay reply for all the samples |
| 494 | * in memory for the specified time series. */ |
| 495 | void 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. */ |
no test coverage detected