projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cd6c194
)
loadtest: added ops/sec meter
author
Art Cancro
<ajc@citadel.org>
Sat, 27 Jan 2024 00:09:34 +0000
(19:09 -0500)
committer
Art Cancro
<ajc@citadel.org>
Sat, 27 Jan 2024 00:09:34 +0000
(19:09 -0500)
citadel/utils/loadtest.c
patch
|
blob
|
history
diff --git
a/citadel/utils/loadtest.c
b/citadel/utils/loadtest.c
index 5a8d2f3a2d1c44552efda06500606bc2011ba63f..0c3924c2212fa5a203a12b2a09f633db52072643 100644
(file)
--- a/
citadel/utils/loadtest.c
+++ b/
citadel/utils/loadtest.c
@@
-208,6
+208,8
@@
char *random_rooms[] = {
int nrooms = sizeof(random_rooms) / sizeof(char *);
char *test_user = "Load Test User";
char test_pass[16];
int nrooms = sizeof(random_rooms) / sizeof(char *);
char *test_user = "Load Test User";
char test_pass[16];
+time_t time_started;
+volatile int ops_completed;
// These are our randomized load test operations: an even mix of changing rooms, posting messages, and deleting messages.
// These are our randomized load test operations: an even mix of changing rooms, posting messages, and deleting messages.
@@
-270,7
+272,6
@@
void perform_random_thing(int serv_sock) {
serv_gets(serv_sock, buf);
} while ( (buf[0] != '2') && (total_msgs > 0));
}
serv_gets(serv_sock, buf);
} while ( (buf[0] != '2') && (total_msgs > 0));
}
-
}
#define ROW_OFFSET 8
}
#define ROW_OFFSET 8
@@
-311,6
+312,10
@@
void *loadtest(void *pointer_to_thread_id) {
while(1) {
perform_random_thing(serv_sock);
printf("\033[%d;%dH\033[32m%8ld\033[0m", row, col, ++ops);
while(1) {
perform_random_thing(serv_sock);
printf("\033[%d;%dH\033[32m%8ld\033[0m", row, col, ++ops);
+ ++ops_completed; // this is declared "volatile" so we don't need to lock it
+ if (thread_id == 0) {
+ printf("\033[2;55H\033[44m\033[33m\033[1m%d ops/sec \033[0m", (ops_completed / (time(NULL) - time_started)));
+ }
fflush(stdout);
}
}
fflush(stdout);
}
}
@@
-409,6
+414,9
@@
int main(int argc, char **argv) {
threadId[i] = i;
}
threadId[i] = i;
}
+ time_started = time(NULL);
+ ops_completed = 0;
+
for (i=1; i<nthreads; ++i) {
pthread_t thread;
for (i=1; i<nthreads; ++i) {
pthread_t thread;