summaryrefslogtreecommitdiff
path: root/source4/torture/nbench/nbench.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-25 23:05:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:10 -0500
commitb6b01064279c0cf5bae8b2324c760f1f7f6be457 (patch)
treecbd19dcceca038b6192dca44c46189d94da234e8 /source4/torture/nbench/nbench.c
parentd019557a53b7e624724cd23cce025731c9808f50 (diff)
downloadsamba-b6b01064279c0cf5bae8b2324c760f1f7f6be457.tar.gz
r3976: changed NBENCH to use the same recording method as the latest dbench,
where the warmup phase continues until all clients have done some file IO. This gives more repeatable results when under high load (This used to be commit aca0658f6dfe8b7c90afcac87e8cc68965a4288d)
Diffstat (limited to 'source4/torture/nbench/nbench.c')
-rw-r--r--source4/torture/nbench/nbench.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c
index 1c90658f49c..afd71537a91 100644
--- a/source4/torture/nbench/nbench.c
+++ b/source4/torture/nbench/nbench.c
@@ -37,11 +37,8 @@ static BOOL run_netbench(struct smbcli_state *cli, int client)
fstring params[20];
const char *p;
BOOL correct = True;
- struct timeval tv;
- tv = timeval_current();
-
- nb_setup(cli, client, warmup);
+ nb_setup(cli, client);
asprintf(&cname, "client%d", client+1);
@@ -56,17 +53,6 @@ again:
while (fgets(line, sizeof(line)-1, f)) {
NTSTATUS status;
- if (warmup &&
- timeval_elapsed(&tv) >= warmup) {
- warmup = 0;
- nb_warmup_done();
- tv = timeval_current();
- }
-
- if (timeval_elapsed(&tv) >= timelimit) {
- goto done;
- }
-
nbench_line_count++;
line[strlen(line)-1] = 0;
@@ -147,6 +133,8 @@ again:
} else {
printf("[%d] Unknown operation %s\n", nbench_line_count, params[0]);
}
+
+ if (nb_tick()) goto done;
}
rewind(f);
@@ -154,7 +142,6 @@ again:
done:
fclose(f);
- nb_cleanup(cname);
if (!torture_close_connection(cli)) {
correct = False;
@@ -188,10 +175,11 @@ BOOL torture_nbench(void)
return False;
}
- nb_setup(cli, -1, warmup);
- nb_deltree("\\clients");
+ if (!torture_setup_dir(cli, "\\clients")) {
+ return False;
+ }
- nbio_shmem(torture_nprocs);
+ nbio_shmem(torture_nprocs, timelimit, warmup);
printf("Running for %d seconds with load '%s' and warmup %d secs\n",
timelimit, loadfile, warmup);
@@ -201,7 +189,8 @@ BOOL torture_nbench(void)
torture_create_procs(run_netbench, &correct);
alarm(0);
- printf("\nThroughput %g MB/sec\n",
- 1.0e-6 * nbio_total() / timelimit);
+ smbcli_deltree(cli->tree, "\\clients");
+
+ printf("\nThroughput %g MB/sec\n", nbio_result());
return correct;
}