@@ -326,6 +326,7 @@ void child_run(struct child_struct *child0, const char *loadfile)
int have_random = 0;
unsigned loop_count = 0;
z_off_t loop_start = 0;
+ struct timeval start;
gzf = gzopen(loadfile, "r");
if (gzf == NULL) {
@@ -349,6 +350,8 @@ again:
nb_time_reset(child);
}
+ gettimeofday(&start, NULL);
+
while (gzgets(gzf, line, sizeof(line)-1)) {
unsigned repeat_count = 1;
@@ -529,6 +532,21 @@ loop_again:
}
}
+ if (options.show_execute_time) {
+ struct timeval end;
+ unsigned int duration;
+
+ gettimeofday(&end, NULL);
+ duration = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_usec - start.tv_usec) / 1000;
+ if (options.machine_readable)
+ printf("@E@%d@%u\n", child0->id, duration);
+ else {
+ printf("%4d completed in %u ms\n", child0->id,
+ duration);
+ }
+ }
+
if (options.run_once) {
goto done;
}
@@ -50,6 +50,7 @@ struct options options = {
.trunc_io = 0,
.iscsi_initiatorname = "iqn.2011-09.org.samba.dbench:client",
.machine_readable = 0,
+ .show_execute_time = 0,
};
static struct timeval tv_start;
@@ -433,6 +434,8 @@ static void process_opts(int argc, const char **argv)
"How many seconds of warmup to run", NULL },
{ "machine-readable", 0, POPT_ARG_NONE, &options.machine_readable, 0,
"Print data in more machine-readable friendly format", NULL},
+ { "show-execute-time", 0, POPT_ARG_NONE, &options.show_execute_time, 0,
+ "Print time to execute passed workload", NULL},
#ifdef HAVE_LIBSMBCLIENT
{ "smb-share", 0, POPT_ARG_STRING, &options.smb_share, 0,
"//SERVER/SHARE to use", NULL },
@@ -159,6 +159,7 @@ struct options {
const char *iscsi_device;
const char *iscsi_initiatorname;
int machine_readable;
+ int show_execute_time;
const char *smb_share;
const char *smb_user;
};