diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-05-17 02:22:29 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:52:32 -0500 |
commit | e9eb862dc0cb100bf2ee3de367a20587346f85aa (patch) | |
tree | 2c16abff874374a4c0419ddb6040ced36f1c42b5 /source4/torture/raw | |
parent | 2741921a509c41904de7ec64ee935ef4f9275c44 (diff) | |
download | samba-e9eb862dc0cb100bf2ee3de367a20587346f85aa.tar.gz samba-e9eb862dc0cb100bf2ee3de367a20587346f85aa.tar.bz2 samba-e9eb862dc0cb100bf2ee3de367a20587346f85aa.zip |
r22962: show progress separately for each client in RAW-BENCH-LOCK, this is
much more useful for seeing why we get unbalanced locking
(This used to be commit 1f1f57023b6d7d7d4938803e57f30e485ccba719)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r-- | source4/torture/raw/lockbench.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index d603878450..690ac85f17 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -54,6 +54,7 @@ struct benchlock_state { int fnum; int offset; int count; + int lastcount; union smb_lock io; struct smb_lock_entry lock[2]; struct smbcli_request *req; @@ -216,6 +217,22 @@ static void lock_completion(struct smbcli_request *req) } } + +static void report_rate(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data) +{ + struct benchlock_state *state = talloc_get_type(private_data, + struct benchlock_state); + int i; + for (i=0;i<nprocs;i++) { + printf("%5u ", (unsigned)(state[i].count - state[i].lastcount)); + state[i].lastcount = state[i].count; + } + printf("\r"); + fflush(stdout); + event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); +} + /* benchmark locking calls */ @@ -228,10 +245,13 @@ BOOL torture_bench_lock(struct torture_context *torture) struct timeval tv; struct event_context *ev = event_context_find(mem_ctx); struct benchlock_state *state; - int total = 0, loops=0, minops=0; + int total = 0, minops=0; NTSTATUS status; struct smbcli_state *cli; - + bool progress; + + progress = torture_setting_bool(torture, "progress", true); + nprocs = lp_parm_int(-1, "torture", "nprocs", 4); state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs); @@ -293,6 +313,10 @@ BOOL torture_bench_lock(struct torture_context *torture) tv = timeval_current(); + if (progress) { + event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); + } + printf("Running for %d seconds\n", timelimit); while (timeval_elapsed(&tv) < timelimit) { event_loop_once(ev); @@ -301,19 +325,6 @@ BOOL torture_bench_lock(struct torture_context *torture) DEBUG(0,("locking failed\n")); goto failed; } - - if (loops++ % 10 != 0) continue; - - total = 0; - for (i=0;i<nprocs;i++) { - total += state[i].count; - } - if (torture_setting_bool(torture, "progress", true)) { - printf("%.2f ops/second (remaining=%u)\r", - total/timeval_elapsed(&tv), - (unsigned)(timelimit - timeval_elapsed(&tv))); - fflush(stdout); - } } printf("%.2f ops/second\n", total/timeval_elapsed(&tv)); |