From: Jens Axboe <axboe@kernel.dk>
To: ehrhardt@linux.vnet.ibm.com
Cc: fio@vger.kernel.org, oberpar@linux.vnet.ibm.com
Subject: Re: [patch 3/9] fio: allow milliseconds on all time specifiers
Date: Fri, 21 Feb 2014 11:49:00 -0800 [thread overview]
Message-ID: <20140221194900.GA29129@kernel.dk> (raw)
In-Reply-To: <20140220132050.651641496@linux.vnet.ibm.com>
On Thu, Feb 20 2014, ehrhardt@linux.vnet.ibm.com wrote:
> From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
>
> This patch allows all time specifiers to be specified down to milliseconds.
> Default will stay seconds for compatibility with old configs.
>
> It also adds documentation to the existing time units day, hour and minute.
THis breaks default delays being in usec, it's not in msec. So if you
had some time set before on options that weren't specifically seconds,
it now would be msec instead of usec. I will commit the below to fix
this.
diff --git a/parse.c b/parse.c
index c8bae0335a4e..5c23d91ebab6 100644
--- a/parse.c
+++ b/parse.c
@@ -126,7 +126,7 @@ static unsigned long long get_mult_time(const char *str, int len)
{
const char *p = str;
char *c;
- unsigned long long mult = 1000;
+ unsigned long long mult = 1;
/*
* Go forward until we hit a non-digit, or +/- sign
@@ -138,22 +138,24 @@ static unsigned long long get_mult_time(const char *str, int len)
}
if (!isalpha((int) *p))
- return 1000;
+ return mult;
c = strdup(p);
for (int i = 0; i < strlen(c); i++)
c[i] = tolower(c[i]);
- if (!strncmp("ms", c, 2))
+ if (!strncmp("us", c, 2) || !strncmp("usec", c, 4))
mult = 1;
- else if (!strcmp("s", c))
+ else if (!strncmp("ms", c, 2) || !strncmp("msec", c, 4))
mult = 1000;
+ else if (!strcmp("s", c))
+ mult = 1000000;
else if (!strcmp("m", c))
- mult = 60 * 1000;
+ mult = 60 * 1000000UL;
else if (!strcmp("h", c))
- mult = 60 * 60 * 1000;
+ mult = 60 * 60 * 1000000UL;
else if (!strcmp("d", c))
- mult = 24 * 60 * 60 * 1000;
+ mult = 24 * 60 * 60 * 1000000UL;
free(c);
return mult;
--
Jens Axboe
next prev parent reply other threads:[~2014-02-21 19:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-20 13:20 [patch 3/9] fio: allow milliseconds on all time specifiers ehrhardt
2014-02-21 19:49 ` Jens Axboe [this message]
[not found] <20140219143639.168501090@linux.vnet.ibm.com>
2014-02-19 15:12 ` Christian Ehrhardt
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=20140221194900.GA29129@kernel.dk \
--to=axboe@kernel.dk \
--cc=ehrhardt@linux.vnet.ibm.com \
--cc=fio@vger.kernel.org \
--cc=oberpar@linux.vnet.ibm.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