summaryrefslogtreecommitdiff
path: root/source4/torture/raw/lockbench.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-02-07 07:11:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:44:47 -0500
commit0d60b9af90962e8db41fdc02cbda562297b1e6d4 (patch)
tree90d53af519d203cd7380fa48d687ba94b7e84de9 /source4/torture/raw/lockbench.c
parentd9bd4dad5036f1460a74f49e5288ceca26ec1b66 (diff)
downloadsamba-0d60b9af90962e8db41fdc02cbda562297b1e6d4.tar.gz
samba-0d60b9af90962e8db41fdc02cbda562297b1e6d4.tar.bz2
samba-0d60b9af90962e8db41fdc02cbda562297b1e6d4.zip
r21216: fail the RAW-BENCH-LOCK test if the locking doesn't happen evenly
across the connections (This used to be commit 01ef699981f3bcbbbdd4a47d9b85324aec783451)
Diffstat (limited to 'source4/torture/raw/lockbench.c')
-rw-r--r--source4/torture/raw/lockbench.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index c3908124aa..4dbefd5d9b 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -105,7 +105,7 @@ 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;
+ int total = 0, loops=0, minops=0;
NTSTATUS status;
nprocs = lp_parm_int(-1, "torture", "nprocs", 4);
@@ -176,6 +176,15 @@ BOOL torture_bench_lock(struct torture_context *torture)
}
printf("%.2f ops/second\n", total/timeval_elapsed(&tv));
+ minops = state[0].count;
+ for (i=0;i<nprocs;i++) {
+ printf("[%d] %u ops\n", i, state[i].count);
+ if (state[i].count < minops) minops = state[i].count;
+ }
+ if (minops < 0.5*total/nprocs) {
+ printf("Failed: unbalanced locking\n");
+ goto failed;
+ }
for (i=0;i<nprocs;i++) {
talloc_free(state[i].req);