]> code.citadel.org Git - citadel.git/blobdiff - citadel/utils/loadtest.c
view_mail.js: more progress on upload dialog
[citadel.git] / citadel / utils / loadtest.c
index 242d15522910f2a230cbc575888f43e41a2deceb..34ea27b88f344ba1fd2cd2689bc19a2c52eb046c 100644 (file)
@@ -1,4 +1,4 @@
-// unfinished load testing utility for Citadel Server
+// Load testing utility for Citadel Server
 //
 // Copyright (c) 1987-2023 by the citadel.org team
 //
@@ -210,6 +210,8 @@ int nrooms = sizeof(random_rooms) / sizeof(char *);
 char *test_user = "Load Test User";
 char test_pass[16];
 
+
+// These are our randomized load test operations: an even mix of changing rooms, posting messages, and deleting messages.
 void perform_random_thing(int serv_sock) {
        int op = random() % 3;
        char buf[SIZ];
@@ -273,6 +275,7 @@ 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) {
        char buf[SIZ];
        int serv_sock;
@@ -296,6 +299,7 @@ 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;
@@ -309,6 +313,7 @@ void *loadtest(void *blah) {
 }
 
 
+// Create (or replace) the account used for load testing, then create the rooms in which we will load test.
 void setup_accounts(int serv_sock) {
        int i;
        char buf[SIZ];
@@ -367,7 +372,7 @@ int main(int argc, char **argv) {
                exit(errno);
        }
 
-       // Generate random password for load test user
+       // Generate a random password for load test user.  No one needs this password except us.
        srand(time(NULL)+getpid());
        for (i=0; i<sizeof(test_pass)-1; ++i) {
                test_pass[i] = (rand() % 74) + 48;