Skip to contentSkip to conversation

stat/options patches

PATCH Applied [email protected] 2 participants 4 messages Feb 19, 2019 – Feb 21, 2019

lore
Share & tools
lore
#0 lore raw

cover stat/options patches

From: Vincent Fu <[email protected]>

Jens, please consider these two patches that address a couple issues that we have encountered. Thanks.

Vincent

Vincent Fu (2):
stat: use long doubles to identify latency percentiles
options: catch division by zero in setting CPU affinity

 options.c | 3 +++
 stat.c    | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 stat: use long doubles to identify latency percentiles

From: Vincent Fu <[email protected]>

In some cases, the 100th percentile latency is not correctly identified because of problems with double precision floating point arithmetic. Use long doubles instead in the while loop condition to reduce the likelihood of encountering this problem.

Also, print an error message when latency percentiles are not successfully identified.

---
 stat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
stat.c +4 -1
index c1f46e1d..66a13bca 100644
@@ -170,7 +170,7 @@ unsigned int calc_clat_percentiles(uint64_t *io_u_plat, unsigned long long nr,
 	is_last = false;
 	for (i = 0; i < FIO_IO_U_PLAT_NR && !is_last; i++) {
 		sum += io_u_plat[i];
-		while (sum >= (plist[j].u.f / 100.0 * nr)) {
+		while (sum >= ((long double) plist[j].u.f / 100.0 * nr)) {
 			assert(plist[j].u.f <= 100.0);
 
 			ovals[j] = plat_idx_to_val(i);
@@ -187,6 +187,9 @@ unsigned int calc_clat_percentiles(uint64_t *io_u_plat, unsigned long long nr,
 		}
 	}
 
+	if (!is_last)
+		log_err("fio: error calculating latency percentiles\n");
+
 	*output = ovals;
 	return len;
 }
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 options: catch division by zero in setting CPU affinity

In reply to [email protected]

From: Vincent Fu <[email protected]>

Catch a division by zero and abort with a helpful message instead of a signal 8 floating point error.

---
 options.c | 3 +++
 1 file changed, 3 insertions(+)
options.c +3 -0
index 6d832354..95086074 100644
@@ -493,6 +493,9 @@ int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
 	const long max_cpu = cpus_online();
 
 	cpus_in_mask = fio_cpu_count(mask);
+	if (!cpus_in_mask)
+		return 0;
+
 	cpu_index = cpu_index % cpus_in_mask;
 
 	index = 0;
Signature · 1 line
2.17.1