diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-03-10 03:24:03 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2004-03-10 03:24:03 +0000 |
commit | 98cbc669a1b742c317677b02c09bdf284f5362aa (patch) | |
tree | 5cfb852852de912e815ae5d67d0939db770bda41 /source4/torture/nbench/nbench.c | |
parent | 3da4329db410c26ea9a8181beb50935491c27a47 (diff) | |
download | samba-98cbc669a1b742c317677b02c09bdf284f5362aa.tar.gz |
added a 5% warmup time to NBENCH to make the results more consistent
(This used to be commit df50911a9c71bf5b8a8988fdbf6c716f8343fa45)
Diffstat (limited to 'source4/torture/nbench/nbench.c')
-rw-r--r-- | source4/torture/nbench/nbench.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c index 3da7dedae13..3a5d9bef70c 100644 --- a/source4/torture/nbench/nbench.c +++ b/source4/torture/nbench/nbench.c @@ -22,6 +22,7 @@ int nbench_line_count = 0; static int timelimit = 600; +static int warmup; static char *loadfile; #define ival(s) strtol(s, NULL, 0) @@ -37,7 +38,7 @@ static BOOL run_netbench(struct cli_state *cli, int client) const char *p; BOOL correct = True; - nb_setup(cli, client); + nb_setup(cli, client, warmup); asprintf(&cname, "client%d", client); @@ -51,6 +52,13 @@ static BOOL run_netbench(struct cli_state *cli, int client) again: while (fgets(line, sizeof(line)-1, f)) { NTSTATUS status; + double t = end_timer(); + + if (warmup && t >= warmup) { + warmup = 0; + nb_warmup_done(); + start_timer(); + } if (end_timer() >= timelimit) { goto done; @@ -152,7 +160,6 @@ done: /* run a test that simulates an approximate netbench client load */ BOOL torture_nbench(int dummy) { - double t; BOOL correct = True; extern int torture_nprocs; struct cli_state *cli; @@ -163,6 +170,8 @@ BOOL torture_nbench(int dummy) timelimit = atoi(p); } + warmup = timelimit / 20; + loadfile = lp_parm_string(-1, "torture", "loadfile"); if (!loadfile || !*loadfile) { loadfile = "client.txt"; @@ -172,19 +181,20 @@ BOOL torture_nbench(int dummy) return False; } - nb_setup(cli, -1); + nb_setup(cli, -1, warmup); nb_deltree("\\clients"); nbio_shmem(torture_nprocs); - printf("Running for %d seconds with load '%s'\n", timelimit, loadfile); + printf("Running for %d seconds with load '%s' and warmup %d secs\n", + timelimit, loadfile, warmup); signal(SIGALRM, SIGNAL_CAST nb_alarm); alarm(1); - t = torture_create_procs(run_netbench, &correct); + torture_create_procs(run_netbench, &correct); alarm(0); printf("\nThroughput %g MB/sec\n", - 1.0e-6 * nbio_total() / t); + 1.0e-6 * nbio_total() / timelimit); return correct; } |