summaryrefslogtreecommitdiff
path: root/source4/torture/nbench/nbench.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-06-17 19:35:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:53:24 -0500
commit428373743a4c5fdde89daa6584dcfc67510319e5 (patch)
tree43ea50e9d3f5a627afe43bae1377ba0fc5916fc8 /source4/torture/nbench/nbench.c
parentde4f15a3ad0efaa02787839f29496abe9f5d5e80 (diff)
downloadsamba-428373743a4c5fdde89daa6584dcfc67510319e5.tar.gz
samba-428373743a4c5fdde89daa6584dcfc67510319e5.tar.bz2
samba-428373743a4c5fdde89daa6584dcfc67510319e5.zip
r23531: added optional latency reporting in BENCH-NBENCH. To use it, you need
to have a load file that puts a timestamp in the first column. That tells NBENCH to target the same throughput as the capture, and to report the maximum amount of latency miss in the test This allows you to quickly see how many clients you can run with while still meeting a given target (This used to be commit 7f045ca4f5e3e777978cad39ac22f0c611af6b10)
Diffstat (limited to 'source4/torture/nbench/nbench.c')
-rw-r--r--source4/torture/nbench/nbench.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c
index f671a5b0de..eb67e15fbb 100644
--- a/source4/torture/nbench/nbench.c
+++ b/source4/torture/nbench/nbench.c
@@ -24,6 +24,7 @@
#include "torture/util.h"
#include "torture/torture.h"
#include "system/filesys.h"
+#include "system/locale.h"
#include "pstring.h"
#include "torture/nbench/proto.h"
@@ -44,7 +45,6 @@ static BOOL run_netbench(struct torture_context *tctx, struct smbcli_state *cli,
pstring line;
char *cname;
FILE *f;
- const char **params;
BOOL correct = True;
if (torture_nprocs == 1) {
@@ -64,9 +64,13 @@ static BOOL run_netbench(struct torture_context *tctx, struct smbcli_state *cli,
return False;
}
+
again:
+ nbio_time_reset();
+
while (fgets(line, sizeof(line)-1, f)) {
NTSTATUS status;
+ const char **params0, **params;
nbench_line_count++;
@@ -74,9 +78,16 @@ again:
all_string_sub(line,"client1", cname, sizeof(line));
- params = str_list_make_shell(NULL, line, " ");
+ params = params0 = str_list_make_shell(NULL, line, " ");
i = str_list_length(params);
+ if (i > 0 && isdigit(params[0][0])) {
+ double targett = strtod(params[0], NULL);
+ nbio_time_delay(targett);
+ params++;
+ i--;
+ }
+
if (i < 2 || params[0][0] == '#') continue;
if (!strncmp(params[0],"SMB", 3)) {
@@ -146,7 +157,7 @@ again:
printf("[%d] Unknown operation %s\n", nbench_line_count, params[0]);
}
- talloc_free(params);
+ talloc_free(params0);
if (nb_tick()) goto done;
}