diff options
author | antirez <antirez@gmail.com> | 2015-02-08 17:39:42 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2015-02-08 17:39:42 +0100 |
commit | cfe21852e79792b08afd2fe0872440edcddf577e (patch) | |
tree | 7a36d3259f7ee3e494d984377ce5886015ee6921 | |
parent | 2723412b7bd15f37b8e714dc43a91732b7b606a3 (diff) | |
download | redis-cfe21852e79792b08afd2fe0872440edcddf577e.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.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c index 512f59fe2..e95c5b413 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -1122,14 +1122,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 { @@ -1173,12 +1168,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"); } |