From fdd4f3034903e50395e72acf74636e4cb12c2291 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 16 Oct 2023 06:59:58 -0900 Subject: [PATCH 1/1] loadtest: change display --- citadel/utils/loadtest.c | 41 +++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/citadel/utils/loadtest.c b/citadel/utils/loadtest.c index 2d62d98ac..5d0e15062 100644 --- a/citadel/utils/loadtest.c +++ b/citadel/utils/loadtest.c @@ -275,10 +275,19 @@ void perform_random_thing(int serv_sock) { // This is the main loop. We log in as the load test user, and then perform random operations until stopped. -void *loadtest(void *blah) { +void *loadtest(void *ptr) { char buf[SIZ]; int serv_sock; + // Find a nice spot on the screen to show the operation count for this thread. + int threadnum; + threadnum = (ptr ? (*(int *)ptr) : 0); + int row = 10 + (threadnum % 20); + int col = (threadnum / 20) * 10; + long ops = 0; + printf("\033[%d;%dH\033[33m 0\033[0m", row, col); + fflush(stdout); + serv_sock = uds_connectsock(file_citadel_socket); if (serv_sock < 0) { @@ -298,12 +307,6 @@ void *loadtest(void *blah) { serv_puts(serv_sock, buf); serv_gets(serv_sock, buf); - // Find a nice spot on the screen to show the operation count for this thread. - int row = 10 + ((serv_sock-3) % 20); - int col = ((serv_sock-3) / 20) * 10; - long ops = 0; - printf("\033[%d;%dH\033[33m 0\033[0m", row, col); - fflush(stdout); while(1) { perform_random_thing(serv_sock); printf("\033[%d;%dH\033[32m%8ld\033[0m", row, col, ++ops); @@ -371,6 +374,14 @@ int main(int argc, char **argv) { exit(errno); } + // set up the screen + for (i=0; i