summaryrefslogtreecommitdiff
path: root/ioshark
diff options
context:
space:
mode:
authorMohan Srinivasan <srmohan@google.com>2017-07-12 14:03:16 -0700
committerMohan Srinivasan <srmohan@google.com>2017-07-12 14:04:14 -0700
commitb9d4b523807ec549c4b93921651122fa4ee9e8d1 (patch)
tree9a548b897e40a53796b53d039bc41be5f0943d03 /ioshark
parenta69f1ec5c0cbd01bac15c7a8e2d3a1b58945af1f (diff)
downloadextras-b9d4b523807ec549c4b93921651122fa4ee9e8d1.tar.gz
Add an option to explicitly specify blockdev.
Add a -b option, that allows user to explicitly specify a blockdev that we want to get stats out of. For example, this allows us to specify the userdata partition (on which IOshark runs). Or in the rare case where support for a new device has not been added yet, we can still run IOshark on it by using this option. Test: Run IOshark with the -b option passed in and verify that the device stats reported match with /proc/diskstats. Change-Id: Ic835697a6aae4484c95537e7d489a9c1fefc0110 Signed-off-by: Mohan Srinivasan <srmohan@google.com>
Diffstat (limited to 'ioshark')
-rw-r--r--ioshark/README2
-rw-r--r--ioshark/ioshark_bench.c8
-rw-r--r--ioshark/ioshark_bench_subr.c6
3 files changed, 13 insertions, 3 deletions
diff --git a/ioshark/README b/ioshark/README
index 0c50fec3..f71a2600 100644
--- a/ioshark/README
+++ b/ioshark/README
@@ -19,6 +19,8 @@ files into a wl.tar file.
device (on /data/local/tmp say). Explode the tarfile.
- Run the tester. "ioshark_bench *.wl" runs the test with default
options. Supported ioshark_bench options :
+-b : Explicitly specify a blockdev (to get IO stats from from
+/proc/diskstats).
-d : Preserve the delays between successive filesystem syscalls as
seen in the original straces.
-n <N> : Run for N iterations
diff --git a/ioshark/ioshark_bench.c b/ioshark/ioshark_bench.c
index f44e73e4..7593394e 100644
--- a/ioshark/ioshark_bench.c
+++ b/ioshark/ioshark_bench.c
@@ -68,6 +68,7 @@ int do_delay = 0;
int verbose = 0;
int summary_mode = 0;
int quick_mode = 0;
+char *blockdev_name = NULL; /* if user would like to specify blockdev */
#if 0
static long gettid()
@@ -78,7 +79,7 @@ static long gettid()
void usage()
{
- fprintf(stderr, "%s [-d preserve_delays] [-n num_iterations] [-t num_threads] -q -v | -s <list of parsed input files>\n",
+ fprintf(stderr, "%s [-b blockdev_name] [-d preserve_delays] [-n num_iterations] [-t num_threads] -q -v | -s <list of parsed input files>\n",
progname);
fprintf(stderr, "%s -s, -v are mutually exclusive\n",
progname);
@@ -661,8 +662,11 @@ main(int argc, char **argv)
struct thread_state_s *state;
progname = argv[0];
- while ((c = getopt(argc, argv, "dn:st:qv")) != EOF) {
+ while ((c = getopt(argc, argv, "b:dn:st:qv")) != EOF) {
switch (c) {
+ case 'b':
+ blockdev_name = strdup(optarg);
+ break;
case 'd':
do_delay = 1;
break;
diff --git a/ioshark/ioshark_bench_subr.c b/ioshark/ioshark_bench_subr.c
index 4280a5a4..e8e93c9c 100644
--- a/ioshark/ioshark_bench_subr.c
+++ b/ioshark/ioshark_bench_subr.c
@@ -375,6 +375,8 @@ get_cores(void)
}
#endif
+extern char *blockdev_name;
+
static void
get_blockdev_name(char *bdev)
{
@@ -402,9 +404,11 @@ get_blockdev_name(char *bdev)
} else if (strncmp(dev_name, "marlin", strlen("marlin")) == 0 ||
strncmp(dev_name, "sailfish", strlen("sailfish")) == 0) {
strcpy(bdev, "sda");
+ } else if (blockdev_name != NULL) {
+ strcpy(bdev, blockdev_name);
} else {
fprintf(stderr,
- "%s: Unknown device %s\n",
+ "%s: Unknown device %s, please specify block device name with -b\n",
progname, dev_name);
exit(1);
}