projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
65a7033
)
Only calculate ops/sec if time>0
author
Art Cancro
<ajc@citadel.org>
Mon, 4 Mar 2024 22:14:05 +0000
(17:14 -0500)
committer
Art Cancro
<ajc@citadel.org>
Mon, 4 Mar 2024 22:14:05 +0000
(17:14 -0500)
citadel/utils/loadtest.c
patch
|
blob
|
history
diff --git
a/citadel/utils/loadtest.c
b/citadel/utils/loadtest.c
index 409ebc04ebc0eaefed5e673f1b1c9b30dd6b235e..0f2285d4ba26a9bca3df8bdab67ac9993db03aa2 100644
(file)
--- a/
citadel/utils/loadtest.c
+++ b/
citadel/utils/loadtest.c
@@
-313,8
+313,7
@@
void *loadtest(void *pointer_to_thread_id) {
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
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) {
- // FIXME the following line produces a divide by zero error on fast machines --- ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
+ if ( (thread_id == 0) && (time(NULL) > time_started) ) {
printf("\033[2;55H\033[44m\033[33m\033[1m%ld ops/sec \033[0m", (ops_completed / (time(NULL) - time_started)));
}
fflush(stdout);
printf("\033[2;55H\033[44m\033[33m\033[1m%ld ops/sec \033[0m", (ops_completed / (time(NULL) - time_started)));
}
fflush(stdout);