From: Luis Chamberlain <mcgrof@kernel.org>
To: raymond.barbiero.dev@gmail.com
Cc: fstests@vger.kernel.org, jack@suse.cz,
mgorman@techsingularity.net, dave@stgolabs.net,
Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 1/4] Allow reporting of workload execution times
Date: Wed, 9 Feb 2022 14:18:46 -0800 [thread overview]
Message-ID: <20220209221849.434616-2-mcgrof@kernel.org> (raw)
In-Reply-To: <20220209221849.434616-1-mcgrof@kernel.org>
From: Jan Kara <jack@suse.cz>
Add option --show-execution-time which reports time it took to each
client to execute the given workload. This allows for better statistics
to be done with dbench results.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
child.c | 18 ++++++++++++++++++
dbench.c | 3 +++
dbench.h | 1 +
3 files changed, 22 insertions(+)
diff --git a/child.c b/child.c
index aea8106..e4ae230 100644
--- a/child.c
+++ b/child.c
@@ -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;
}
diff --git a/dbench.c b/dbench.c
index 1369a38..178a175 100644
--- a/dbench.c
+++ b/dbench.c
@@ -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 },
diff --git a/dbench.h b/dbench.h
index 14a5a70..465cf3b 100644
--- a/dbench.h
+++ b/dbench.h
@@ -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;
};
--
2.34.1
next prev parent reply other threads:[~2022-02-09 22:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 22:18 [PATCH 0/4] dbench: few enhancements from mmtests Luis Chamberlain
2022-02-09 22:18 ` Luis Chamberlain [this message]
2022-02-09 22:18 ` [PATCH 2/4] Defer reporting of execution times Luis Chamberlain
2022-02-09 22:18 ` [PATCH 3/4] libnfs: Include stdint.h Luis Chamberlain
2022-02-09 22:18 ` [PATCH 4/4] Check if parent is alive once per loadfile processed Luis Chamberlain
2022-02-10 9:44 ` [PATCH 0/4] dbench: few enhancements from mmtests Jan Kara
2022-02-10 10:16 ` Mel Gorman
2022-02-10 13:04 ` Davidlohr Bueso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220209221849.434616-2-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=dave@stgolabs.net \
--cc=fstests@vger.kernel.org \
--cc=jack@suse.cz \
--cc=mgorman@techsingularity.net \
--cc=raymond.barbiero.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).