summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-07-19 13:58:04 +0200
committerantirez <antirez@gmail.com>2018-07-19 13:58:04 +0200
commit8d617596f1ba5eab71820b0e8faafad893a40176 (patch)
tree44db2f80c7be29636a169519271a88357d429232
parent85a1b4f807fd7651184363fadb4a8cdac864adc6 (diff)
downloadredis-8d617596f1ba5eab71820b0e8faafad893a40176.tar.gz
Implement a function to retrieve the expansive clients mem usage.
-rw-r--r--src/server.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/server.c b/src/server.c
index b14d0740e..15417a757 100644
--- a/src/server.c
+++ b/src/server.c
@@ -920,6 +920,18 @@ int clientsCronTrackExpansiveClients(client *c) {
return 0; /* This function never terminates the client. */
}
+/* Return the max samples in the memory usage of clients tracked by
+ * the function clientsCronTrackExpansiveClients(). */
+void getExpansiveClientsInfo(size_t *in_usage, size_t *out_usage) {
+ size_t i = 0, o = 0;
+ for (int j = 0; j < CLIENTS_PEAK_MEM_USAGE_SLOTS; j++) {
+ if (ClientsPeakMemInput[j] > i) i = ClientsPeakMemInput[j];
+ if (ClientsPeakMemOutput[j] > o) o = ClientsPeakMemOutput[o];
+ }
+ *in_usage = i;
+ *out_usage = o;
+}
+
#define CLIENTS_CRON_MIN_ITERATIONS 5
void clientsCron(void) {
/* Make sure to process at least numclients/server.hz of clients