summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-03-17 09:59:30 +0100
committerStefan Metzmacher <metze@samba.org>2008-03-17 15:50:54 +0100
commitb65ad8966a7ffba15b64b837610a65694336f80a (patch)
tree137f053bb163a019aae0ae7e461e48d9eef84902
parent0de47f6b577fdb1e93395b56960951b32cca48c0 (diff)
downloadsamba-b65ad8966a7ffba15b64b837610a65694336f80a.tar.gz
samba-b65ad8966a7ffba15b64b837610a65694336f80a.tar.bz2
samba-b65ad8966a7ffba15b64b837610a65694336f80a.zip
RAW-BENCH-OPEN: fix the output and calculate the total operations
metze (This used to be commit c84e3abae9781c0cbea5fee00bafe70967fb6468)
-rw-r--r--source4/torture/raw/openbench.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index 87b27d0728..8f4558e732 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -37,7 +37,7 @@
static int nprocs;
static int open_failed;
-static int open_retries;
+static int close_failed;
static char **fnames;
static int num_connected;
static struct timed_event *report_te;
@@ -55,6 +55,7 @@ struct benchopen_state {
int count;
int lastcount;
union smb_open open_parms;
+ int open_retries;
union smb_close close_parms;
struct smbcli_request *req_open;
struct smbcli_request *req_close;
@@ -228,7 +229,7 @@ static void open_completed(struct smbcli_request *req)
if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
DEBUG(2,("[%d] retrying open\n", state->client_num));
- open_retries++;
+ state->open_retries++;
state->req_open = smb_raw_open_send(state->tree, &state->open_parms);
state->req_open->async.fn = open_completed;
state->req_open->async.private = state;
@@ -280,7 +281,7 @@ static void close_completed(struct smbcli_request *req)
}
if (!NT_STATUS_IS_OK(status)) {
- open_failed++;
+ close_failed++;
DEBUG(0,("close failed - %s\n", nt_errstr(status)));
return;
}
@@ -352,7 +353,9 @@ bool torture_bench_open(struct torture_context *torture)
struct timeval tv;
struct event_context *ev = event_context_find(mem_ctx);
struct benchopen_state *state;
- int total = 0, minops=0;
+ int total = 0;
+ int total_retries = 0;
+ int minops = 0;
bool progress=false;
progress = torture_setting_bool(torture, "progress", true);
@@ -420,17 +423,24 @@ bool torture_bench_open(struct torture_context *torture)
DEBUG(0,("open failed\n"));
goto failed;
}
+ if (close_failed) {
+ DEBUG(0,("open failed\n"));
+ goto failed;
+ }
}
talloc_free(report_te);
- printf("%.2f ops/second (%d retries)\n",
- total/timeval_elapsed(&tv), open_retries);
minops = state[0].count;
for (i=0;i<nprocs;i++) {
- printf("[%d] %u ops\n", i, state[i].count);
+ total += state[i].count;
+ total_retries += state[i].open_retries;
+ printf("[%d] %u ops (%u retries)\n",
+ i, state[i].count, state[i].open_retries);
if (state[i].count < minops) minops = state[i].count;
}
+ printf("%.2f ops/second (%d retries)\n",
+ total/timeval_elapsed(&tv), total_retries);
if (minops < 0.5*total/nprocs) {
printf("Failed: unbalanced open\n");
goto failed;