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
#include "torture/util.h"
#include "torture/torture.h"
#include "system/filesys.h"
#include "torture/util.h"
#include "torture/torture.h"
#include "system/filesys.h"
+#include "system/locale.h"
#include "pstring.h"
#include "torture/nbench/proto.h"
#include "pstring.h"
#include "torture/nbench/proto.h"
pstring line;
char *cname;
FILE *f;
pstring line;
char *cname;
FILE *f;
BOOL correct = True;
if (torture_nprocs == 1) {
BOOL correct = True;
if (torture_nprocs == 1) {
while (fgets(line, sizeof(line)-1, f)) {
NTSTATUS status;
while (fgets(line, sizeof(line)-1, f)) {
NTSTATUS status;
+ const char **params0, **params;
all_string_sub(line,"client1", cname, sizeof(line));
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);
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)) {
if (i < 2 || params[0][0] == '#') continue;
if (!strncmp(params[0],"SMB", 3)) {
printf("[%d] Unknown operation %s\n", nbench_line_count, params[0]);
}
printf("[%d] Unknown operation %s\n", nbench_line_count, params[0]);
}
if (nb_tick()) goto done;
}
if (nb_tick()) goto done;
}
double bytes, warmup_bytes;
int line;
int done;
double bytes, warmup_bytes;
int line;
int done;
+ double max_latency;
+ struct timeval starttime;
+void nbio_time_reset(void)
+{
+ children[nbio_id].starttime = timeval_current();
+}
+
+void nbio_time_delay(double targett)
+{
+ double elapsed = timeval_elapsed(&children[nbio_id].starttime);
+ if (targett > elapsed) {
+ msleep(1000*(targett - elapsed));
+ } else if (elapsed - targett > children[nbio_id].max_latency) {
+ children[nbio_id].max_latency = elapsed - targett;
+ }
+}
+
double nbio_result(void)
{
int i;
double nbio_result(void)
{
int i;
return 1.0e-6 * total / timeval_elapsed2(&tv_start, &tv_end);
}
return 1.0e-6 * total / timeval_elapsed2(&tv_start, &tv_end);
}
+double nbio_latency(void)
+{
+ int i;
+ double max_latency = 0;
+ for (i=0;i<nprocs;i++) {
+ if (children[i].max_latency > max_latency) {
+ max_latency = children[i].max_latency;
+ children[i].max_latency = 0;
+ }
+ }
+ return max_latency;
+}
+
BOOL nb_tick(void)
{
return children[nbio_id].done;
BOOL nb_tick(void)
{
return children[nbio_id].done;
nprocs, lines/nprocs,
nbio_result(), t);
} else {
nprocs, lines/nprocs,
nbio_result(), t);
} else {
- printf("%4d %8d %.2f MB/sec execute %.0f sec \n",
+ printf("%4d %8d %.2f MB/sec execute %.0f sec latency %.2f msec \n",
+ nbio_result(), t, nbio_latency() * 1.0e3);
io.readx.in.remaining = 0;
io.readx.in.read_for_execute = False;
io.readx.out.data = buf;
io.readx.in.remaining = 0;
io.readx.in.read_for_execute = False;
io.readx.out.data = buf;
ret = smb_raw_read(c->tree, &io);
free(buf);
ret = smb_raw_read(c->tree, &io);
free(buf);