diff options
author | Ken Raeburn <raeburn@mit.edu> | 2009-11-07 00:14:37 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2009-11-07 00:14:37 +0000 |
commit | 2b4dfde357e61f8eac1f4f9e0cb95698baceab7e (patch) | |
tree | 76a954563bcdfa184b8512b18e56a0e0f8a7f612 | |
parent | 67bf2ef0bbdf5e79df0ba44c6ab9e320eb5f594b (diff) | |
download | krb5-2b4dfde357e61f8eac1f4f9e0cb95698baceab7e.zip krb5-2b4dfde357e61f8eac1f4f9e0cb95698baceab7e.tar.gz krb5-2b4dfde357e61f8eac1f4f9e0cb95698baceab7e.tar.bz2 |
Don't flush stdout so much. Calculate and display some more averages
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23142 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/tests/threads/t_rcache.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tests/threads/t_rcache.c b/src/tests/threads/t_rcache.c index 5392f55..e952309 100644 --- a/src/tests/threads/t_rcache.c +++ b/src/tests/threads/t_rcache.c @@ -120,8 +120,10 @@ static void *run_a_loop (void *x) t.now = time(0); try_one(&t); t.total++; -/* printf("%c", chr); */ +#if 0 + printf("%c", chr); fflush(stdout); +#endif } /* printf("thread %u total %u\n", (unsigned) ((int *)x-ip), t.total);*/ *(int*)x = t.total; @@ -172,6 +174,7 @@ int main (int argc, char *argv[]) { krb5_error_code err; int i; + unsigned long sum; process_options (argc, argv); err = krb5_init_context(&ctx); @@ -237,9 +240,15 @@ int main (int argc, char *argv[]) } while (time(0) < end_time + 1) sleep(1); - for (i = 0; i < n_threads; i++) + sum = 0; + for (i = 0; i < n_threads; i++) { + sum += ip[i]; printf("thread %d total %5d, about %.1f per second\n", i, ip[i], ((double) ip[i])/interval); + } + printf("total %lu in %d seconds, avg ~%.1f/sec, ~%.1f/sec/thread\n", + sum, interval, + ((double)sum)/interval, ((double)sum)/interval/n_threads); free(ip); if (init_once) |