Re: [patch 3/9] fio: allow milliseconds on all time specifiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 20 2014, ehrhardt@xxxxxxxxxxxxxxxxxx wrote:
> From: Christian Ehrhardt <ehrhardt@xxxxxxxxxxxxxxxxxx>
> 
> 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

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux