[PATCH 3/5] stat: simplify add_lat_percentile_prio_sample()

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

 



From: Niklas Cassel <niklas.cassel@xxxxxxx>

When trying the understand the how clat and lat samples are handled,
the natural place to start looking is add_clat_sample() and
add_clat_sample().

However, from looking at these functions, it is not obvious to see that
add_lat_percentile_prio_sample() will add both a prio sample, as well
as a regular sample.

Since these are two completely different samples being added, make this
fact more obvious to the reader by calling each function separately.

Signed-off-by: Niklas Cassel <niklas.cassel@xxxxxxx>
---
 stat.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/stat.c b/stat.c
index d08510d0..74f48dee 100644
--- a/stat.c
+++ b/stat.c
@@ -3065,12 +3065,10 @@ static void add_lat_percentile_sample(struct thread_stat *ts,
 static void add_lat_percentile_prio_sample(struct thread_stat *ts,
 					   unsigned long long nsec,
 					   enum fio_ddir ddir,
-					   bool high_prio, enum fio_lat lat)
+					   bool high_prio)
 {
 	unsigned int idx = plat_val_to_idx(nsec);
 
-	add_lat_percentile_sample(ts, nsec, ddir, lat);
-
 	if (!high_prio)
 		ts->io_u_plat_low_prio[ddir][idx]++;
 	else
@@ -3103,11 +3101,10 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
 			       offset, ioprio);
 
 	if (ts->clat_percentiles) {
-		if (ts->lat_percentiles)
-			add_lat_percentile_sample(ts, nsec, ddir, FIO_CLAT);
-		else
-			add_lat_percentile_prio_sample(ts, nsec, ddir, high_prio,
-						       FIO_CLAT);
+		add_lat_percentile_sample(ts, nsec, ddir, FIO_CLAT);
+		if (!ts->lat_percentiles)
+			add_lat_percentile_prio_sample(ts, nsec, ddir,
+						       high_prio);
 	}
 
 	if (iolog && iolog->hist_msec) {
@@ -3198,8 +3195,8 @@ void add_lat_sample(struct thread_data *td, enum fio_ddir ddir,
 			       offset, ioprio);
 
 	if (ts->lat_percentiles) {
-		add_lat_percentile_prio_sample(ts, nsec, ddir, high_prio,
-					       FIO_LAT);
+		add_lat_percentile_sample(ts, nsec, ddir, FIO_LAT);
+		add_lat_percentile_prio_sample(ts, nsec, ddir, high_prio);
 		if (high_prio)
 			add_stat_sample(&ts->clat_high_prio_stat[ddir], nsec);
 		else
-- 
2.33.1




[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