From d5c156e378b2e54de49446ad3b2bfc66e329482c Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 1 Sep 2023 16:10:02 +0000 Subject: [PATCH] loadtest: pretty display when running with hundreds of threads --- citadel/utils/loadtest.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/citadel/utils/loadtest.c b/citadel/utils/loadtest.c index b376f7d5c..8a71fe077 100644 --- a/citadel/utils/loadtest.c +++ b/citadel/utils/loadtest.c @@ -288,13 +288,15 @@ void do_stuff(int serv_sock) { serv_puts(serv_sock, buf); serv_gets(serv_sock, buf); - printf("\033[%d;0H\033[32m%6d\033[0m", 7+serv_sock, serv_sock-3); - + int row = 10 + ((serv_sock-3) % 20); + int col = ((serv_sock-3) / 20) * 10; long ops = 0; + printf("\033[%d;%dH\033[32m--------\033[0m", row, col); + fflush(stdout); + sleep(1); while(1) { - //alarm(30); perform_random_thing(serv_sock); - printf("\033[%d;11H\033[33m%8ld\033[0m", 7+serv_sock, ++ops); + printf("\033[%d;%dH\033[33m%8ld\033[0m", row, col, ++ops); fflush(stdout); } } @@ -341,12 +343,12 @@ int main(int argc, char **argv) { int nthreads = 3; fprintf(stderr, "\033[2J\033[H" - "\033[44m\033[33m\033[1m \033[K\033[0m\n" - "\033[44m\033[33m\033[1m Load testing utility for Citadel \033[K\033[0m\n" - "\033[44m\033[33m\033[1m Copyright (c) 2023 by citadel.org et al. \033[K\033[0m\n" + "\033[44m\033[33m\033[1m \033[K\033[0m\n" + "\033[44m\033[33m\033[1m Load testing utility for Citadel \033[K\033[0m\n" + "\033[44m\033[33m\033[1m Copyright (c) 2023 by citadel.org et al. \033[K\033[0m\n" "\033[44m\033[33m\033[1m This program is open source software. Use, duplication, or disclosure \033[K\033[0m\n" - "\033[44m\033[33m\033[1m is subject to the terms of the GNU General Public license v3. \033[K\033[0m\n" - "\033[44m\033[33m\033[1m \033[K\033[0m\n"); + "\033[44m\033[33m\033[1m is subject to the terms of the GNU General Public license v3. \033[K\033[0m\n" + "\033[44m\033[33m\033[1m \033[K\033[0m\n"); // Parse command line while ((a = getopt(argc, argv, "h:n:")) != EOF) { @@ -374,8 +376,6 @@ int main(int argc, char **argv) { setup_accounts(serv_sock); close(serv_sock); - printf("\033[8Hthread num_ops\n------ -----------"); - for (a=0; a<(nthreads-1); ++a) { pthread_t thread; pthread_attr_t attr; -- 2.39.2