summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-02-08 17:39:42 +0100
committerantirez <antirez@gmail.com>2015-02-10 14:51:25 +0100
commit9a4d71e92e27049ba115eb188b4c6c45540521d7 (patch)
tree5e5abb71be9654fd36c97eb8a27ef788f141ad54
parentad9976cd90ae60716515c1f34552661679f37ca4 (diff)
downloadredis-9a4d71e92e27049ba115eb188b4c6c45540521d7.tar.gz
redis-cli --latecy-dist reverted to gray scale.
So far not able to find a color palette within the 256 colors which is not confusing. However I believe it is a possible task, so will try better later.
-rw-r--r--src/redis-cli.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 67bf9cde6..3eba86ce1 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -1095,14 +1095,9 @@ static void latencyMode(void) {
#define LATENCY_DIST_MAX_GRAY 255
#define LATENCY_DIST_GRAYS (LATENCY_DIST_MAX_GRAY-LATENCY_DIST_MIN_GRAY+1)
-/* Gray palette. Currently not used.
- * int spectrum_palette_size = 24;
-* int spectrum_palette[] = {0, 233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255};
-*/
-
-/* Color palette from https://github.com/draios/sysdig */
-int spectrum_palette[] = {0, 22, 28, 64, 34, 2, 76, 46, 118, 154, 191, 227, 226, 11, 220, 209, 208, 202, 197, 9, 1};
-int spectrum_palette_size = 21;
+/* Gray palette. */
+int spectrum_palette_size = 24;
+int spectrum_palette[] = {0, 233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255};
/* Structure to store samples distribution. */
struct distsamples {
@@ -1146,12 +1141,19 @@ void showLatencyDistSamples(struct distsamples *samples, long long tot) {
/* Show the legend: different buckets values and colors meaning, so
* that the spectrum is more easily readable. */
void showLatencyDistLegend(void) {
+ int j;
+
printf("---------------------------------------------\n");
printf(". - * # .01 .125 .25 .5 milliseconds\n");
printf("1,2,3,...,9 from 1 to 9 milliseconds\n");
printf("A,B,C,D,E 10,20,30,40,50 milliseconds\n");
printf("F,G,H,I,J .1,.2,.3,.4,.5 seconds\n");
printf("K,L,M,N,O,P,Q,? 1,2,4,8,16,30,60,>60 seconds\n");
+ printf("From 0 to 100%%: ");
+ for (j = 0; j < spectrum_palette_size; j++) {
+ printf("\033[48;5;%dm ", spectrum_palette[j]);
+ }
+ printf("\033[0m\n");
printf("---------------------------------------------\n");
}