[PATCH] Eliminate extraneous JSON output

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

 



Jens, please consider the attached patch.

I'm not certain the place I have added the code is optimal, but it does
appear to resolve the problem both when fio is run directly and when fio
is run in client/server mode.

The steadystate feature also depends on group_reporting being set for
all members of a reporting group if it is set for any member.

Vincent

--
Vincent Fu
Software Dev Engr II
SanDisk, a Western Digital brand
Email: Vincent.Fu@xxxxxxxxxxx
Office: 801 987 7079

PLEASE NOTE: The information contained in this electronic mail message is intended only for the use of the designated recipient(s) named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender by telephone or e-mail (as shown above) immediately and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies).
From 54d59f68dc1d47aba865e3ed7016211ee0ca468e Mon Sep 17 00:00:00 2001
From: Vincent Fu <Vincent.Fu@xxxxxxxxxxx>
Date: Tue, 25 Oct 2016 15:51:30 -0400
Subject: [PATCH] Eliminate extraneous JSON output

./fio --name=global --filename=/dev/urandom --time_based --runtime=3 --size=1M --name=job1 --name=job2 --group_reporting --output-format=json

will produce two objects in jobs[], even though group_reprting is enabled. The second object will be essentially empty.

This is because the code in stat.c:__show_run_stats that counts how many threadstats are needed assumes that if group_reporting is set for one job within a reporting group, it is also set for all the other jobs in the reporting group.

This patch makes the assumption true by setting group_reporting to true for all jobs within a reporting group if it is set for any job within the reporting group.
---
 init.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/init.c b/init.c
index d8c0bd1..46b8a61 100644
--- a/init.c
+++ b/init.c
@@ -1288,11 +1288,12 @@ static bool wait_for_ok(const char *jobname, struct thread_options *o)
 static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
 		   int recursed, int client_type)
 {
-	unsigned int i;
+	unsigned int i, j;
 	char fname[PATH_MAX];
 	int numjobs, file_alloced;
 	struct thread_options *o = &td->o;
 	char logname[PATH_MAX + 32];
+	struct thread_data *td2;
 
 	/*
 	 * the def_thread is just for options, it's not a real job
@@ -1381,6 +1382,17 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
 	td->groupid = groupid;
 	prev_group_jobs++;
 
+	/*
+	 * If group_reporting is set for one job in a reporting group,
+	 * set it for all the other jobs in the reporting group
+	 */
+	for_each_td(td2, j) {
+		if (td2->groupid == groupid && td2->o.group_reporting)
+			o->group_reporting = 1;
+		if (o->group_reporting && td2->groupid == groupid)
+			td2->o.group_reporting = 1;
+	}
+
 	if (setup_random_seeds(td)) {
 		td_verror(td, errno, "init_random_state");
 		goto err;
-- 
2.7.4 (Apple Git-66)


[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