aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <clm@fb.com>2016-04-07 08:28:08 -0700
committerChris Mason <clm@fb.com>2016-04-07 08:28:08 -0700
commit5b436cfea2a037eb2ff44f3794245e40d2d0762c (patch)
treedb6e750c43464d22113170867d43cd7d0f2d2898
parent5e047f90ba8153b9ced1483ab8f4c59a39cb5381 (diff)
downloadschbench-5b436cfea2a037eb2ff44f3794245e40d2d0762c.tar.gz
Force cputime/sleeptime to zero in pipe mode, unless user supplies values
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--schbench.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/schbench.c b/schbench.c
index 19e2e69..a0e9f7e 100644
--- a/schbench.c
+++ b/schbench.c
@@ -104,6 +104,8 @@ static void print_usage(void)
static void parse_options(int ac, char **av)
{
int c;
+ int found_sleeptime = -1;
+ int found_cputime = -1;
while (1) {
int option_index = 0;
@@ -125,12 +127,14 @@ static void parse_options(int ac, char **av)
PIPE_TRANSFER_BUFFER);
pipe_test = PIPE_TRANSFER_BUFFER;
}
+ sleeptime = 0;
+ cputime = 0;
break;
case 's':
- sleeptime = atoi(optarg);
+ found_sleeptime = atoi(optarg);
break;
case 'c':
- cputime = atoi(optarg);
+ found_cputime = atoi(optarg);
break;
case 'm':
message_threads = atoi(optarg);
@@ -150,6 +154,15 @@ static void parse_options(int ac, char **av)
}
}
+ /*
+ * by default pipe mode zeros out cputime and sleep time. This
+ * sets them to any args that were actually passed in
+ */
+ if (found_sleeptime >= 0)
+ sleeptime = found_sleeptime;
+ if (found_cputime >= 0)
+ cputime = found_cputime;
+
if (optind < ac) {
fprintf(stderr, "Error Extra arguments '%s'\n", av[optind]);
exit(1);
@@ -755,7 +768,7 @@ again:
if (!message_threads_mem) {
- perror("unable to allocate ram");
+ perror("unable to allocate message threads");
exit(1);
}