latencyCommand() helper to produce the reply for the LATEST subcommand, * listing the last latency sample for every event type registered so far. */
| 511 | /* latencyCommand() helper to produce the reply for the LATEST subcommand, |
| 512 | * listing the last latency sample for every event type registered so far. */ |
| 513 | void latencyCommandReplyWithLatestEvents(client *c) { |
| 514 | dictIterator *di; |
| 515 | dictEntry *de; |
| 516 | |
| 517 | addReplyArrayLen(c,dictSize(g_pserver->latency_events)); |
| 518 | di = dictGetIterator(g_pserver->latency_events); |
| 519 | while((de = dictNext(di)) != NULL) { |
| 520 | char *event = (char*)dictGetKey(de); |
| 521 | struct latencyTimeSeries *ts = (latencyTimeSeries*)dictGetVal(de); |
| 522 | int last = (ts->idx + LATENCY_TS_LEN - 1) % LATENCY_TS_LEN; |
| 523 | |
| 524 | addReplyArrayLen(c,4); |
| 525 | addReplyBulkCString(c,event); |
| 526 | addReplyLongLong(c,ts->samples[last].time); |
| 527 | addReplyLongLong(c,ts->samples[last].latency); |
| 528 | addReplyLongLong(c,ts->max); |
| 529 | } |
| 530 | dictReleaseIterator(di); |
| 531 | } |
| 532 | |
| 533 | #define LATENCY_GRAPH_COLS 80 |
| 534 | sds latencyCommandGenSparkeline(char *event, struct latencyTimeSeries *ts) { |
no test coverage detected