All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krishna Kanth Reddy <krish.reddy@samsung.com>
To: axboe@kernel.dk
Cc: fio@vger.kernel.org, Ankit Kumar <ankit.kumar@samsung.com>,
	Krishna Kanth Reddy <krish.reddy@samsung.com>
Subject: [PATCH 3/9] Added support for printing of stats and estimate time for copy operation.
Date: Tue,  1 Dec 2020 17:10:28 +0530	[thread overview]
Message-ID: <20201201114034.8307-4-krish.reddy@samsung.com> (raw)
In-Reply-To: <20201201114034.8307-1-krish.reddy@samsung.com>

From: Ankit Kumar <ankit.kumar@samsung.com>

Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
---
 backend.c |  3 +++
 eta.c     | 31 ++++++++++++++++++++++---------
 stat.c    | 20 +++++++++++++++-----
 stat.h    |  1 -
 4 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/backend.c b/backend.c
index 2e6a377c..2f4d6ac4 100644
--- a/backend.c
+++ b/backend.c
@@ -1828,6 +1828,8 @@ static void *thread_main(void *data)
 			update_runtime(td, elapsed_us, DDIR_WRITE);
 		if (td_trim(td) && td->io_bytes[DDIR_TRIM])
 			update_runtime(td, elapsed_us, DDIR_TRIM);
+		if (td_copy(td) && td->io_bytes[DDIR_COPY])
+			update_runtime(td, elapsed_us, DDIR_COPY);
 		fio_gettime(&td->start, NULL);
 		fio_sem_up(stat_sem);
 
@@ -2491,6 +2493,7 @@ int fio_backend(struct sk_out *sk_out)
 		setup_log(&agg_io_log[DDIR_READ], &p, "agg-read_bw.log");
 		setup_log(&agg_io_log[DDIR_WRITE], &p, "agg-write_bw.log");
 		setup_log(&agg_io_log[DDIR_TRIM], &p, "agg-trim_bw.log");
+		setup_log(&agg_io_log[DDIR_COPY], &p, "agg-copy_bw.log");
 	}
 
 	startup_sem = fio_sem_init(FIO_SEM_LOCKED);
diff --git a/eta.c b/eta.c
index d1c9449f..cb89013c 100644
--- a/eta.c
+++ b/eta.c
@@ -82,6 +82,11 @@ static void check_str_update(struct thread_data *td)
 				c = 'w';
 			else
 				c = 'W';
+		} else if (td_copy(td)) {
+			if (td_random(td))
+				c = 'q';
+			else
+				c = 'Q';
 		} else {
 			if (td_random(td))
 				c = 'd';
@@ -292,6 +297,8 @@ static unsigned long thread_eta(struct thread_data *td)
 			rate_bytes += td->o.rate[DDIR_WRITE];
 		if (td_trim(td))
 			rate_bytes += td->o.rate[DDIR_TRIM];
+		if (td_copy(td))
+			rate_bytes += td->o.rate[DDIR_COPY];
 
 		if (rate_bytes) {
 			r_eta = bytes_total / rate_bytes;
@@ -445,6 +452,12 @@ bool calc_thread_status(struct jobs_eta *je, int force)
 				je->m_rate[2] += td->o.ratemin[DDIR_TRIM];
 				je->m_iops[2] += td->o.rate_iops_min[DDIR_TRIM];
 			}
+			if (td_copy(td)) {
+				je->t_rate[3] += td->o.rate[DDIR_COPY];
+				je->t_iops[3] += td->o.rate_iops[DDIR_COPY];
+				je->m_rate[3] += td->o.ratemin[DDIR_COPY];
+				je->m_iops[3] += td->o.rate_iops_min[DDIR_COPY];
+			}
 
 			je->files_open += td->nr_open_files;
 		} else if (td->runstate == TD_RAMP) {
@@ -534,7 +547,7 @@ bool calc_thread_status(struct jobs_eta *je, int force)
 static int gen_eta_str(struct jobs_eta *je, char *p, size_t left,
 		       char **rate_str, char **iops_str)
 {
-	static const char c[DDIR_RWDIR_CNT] = {'r', 'w', 't'};
+	static const char c[DDIR_RWDIR_CNT] = {'r', 'w', 't', 'c'};
 	bool has[DDIR_RWDIR_CNT];
 	bool has_any = false;
 	const char *sep;
@@ -594,23 +607,23 @@ void display_thread_status(struct jobs_eta *je)
 	p += sprintf(p, "Jobs: %d (f=%d)", je->nr_running, je->files_open);
 
 	/* rate limits, if any */
-	if (je->m_rate[0] || je->m_rate[1] || je->m_rate[2] ||
-	    je->t_rate[0] || je->t_rate[1] || je->t_rate[2]) {
+	if (je->m_rate[0] || je->m_rate[1] || je->m_rate[2] || je->m_rate[3] ||
+	    je->t_rate[0] || je->t_rate[1] || je->t_rate[2] || je->t_rate[3]) {
 		char *tr, *mr;
 
-		mr = num2str(je->m_rate[0] + je->m_rate[1] + je->m_rate[2],
+		mr = num2str(je->m_rate[0] + je->m_rate[1] + je->m_rate[2] + je->m_rate[3],
 				je->sig_figs, 0, je->is_pow2, N2S_BYTEPERSEC);
-		tr = num2str(je->t_rate[0] + je->t_rate[1] + je->t_rate[2],
+		tr = num2str(je->t_rate[0] + je->t_rate[1] + je->t_rate[2] + je->t_rate[3],
 				je->sig_figs, 0, je->is_pow2, N2S_BYTEPERSEC);
 
 		p += sprintf(p, ", %s-%s", mr, tr);
 		free(tr);
 		free(mr);
-	} else if (je->m_iops[0] || je->m_iops[1] || je->m_iops[2] ||
-		   je->t_iops[0] || je->t_iops[1] || je->t_iops[2]) {
+	} else if (je->m_iops[0] || je->m_iops[1] || je->m_iops[2] || je->m_iops[3] ||
+		   je->t_iops[0] || je->t_iops[1] || je->t_iops[2] || je->t_iops[3]) {
 		p += sprintf(p, ", %d-%d IOPS",
-					je->m_iops[0] + je->m_iops[1] + je->m_iops[2],
-					je->t_iops[0] + je->t_iops[1] + je->t_iops[2]);
+					je->m_iops[0] + je->m_iops[1] + je->m_iops[2] + je->m_iops[3],
+					je->t_iops[0] + je->t_iops[1] + je->t_iops[2] + je->t_iops[3]);
 	}
 
 	/* current run string, % done, bandwidth, iops, eta */
diff --git a/stat.c b/stat.c
index eb40bd7f..0e348bf6 100644
--- a/stat.c
+++ b/stat.c
@@ -286,7 +286,7 @@ void show_group_stats(struct group_run_stats *rs, struct buf_output *out)
 {
 	char *io, *agg, *min, *max;
 	char *ioalt, *aggalt, *minalt, *maxalt;
-	const char *str[] = { "   READ", "  WRITE" , "   TRIM"};
+	const char *str[] = { "   READ", "  WRITE" , "   TRIM", "   COPY"};
 	int i;
 
 	log_buf(out, "\nRun status group %d (all jobs):\n", rs->groupid);
@@ -1124,19 +1124,22 @@ static void show_thread_status_normal(struct thread_stat *ts,
 					io_u_dist[1], io_u_dist[2],
 					io_u_dist[3], io_u_dist[4],
 					io_u_dist[5], io_u_dist[6]);
-	log_buf(out, "     issued rwts: total=%llu,%llu,%llu,%llu"
-				 " short=%llu,%llu,%llu,0"
-				 " dropped=%llu,%llu,%llu,0\n",
+	log_buf(out, "     issued rwts: total=%llu,%llu,%llu,%llu,%llu"
+				 " short=%llu,%llu,%llu,%llu,0"
+				 " dropped=%llu,%llu,%llu,%llu,0\n",
 					(unsigned long long) ts->total_io_u[0],
 					(unsigned long long) ts->total_io_u[1],
 					(unsigned long long) ts->total_io_u[2],
 					(unsigned long long) ts->total_io_u[3],
+					(unsigned long long) ts->total_io_u[4],
 					(unsigned long long) ts->short_io_u[0],
 					(unsigned long long) ts->short_io_u[1],
 					(unsigned long long) ts->short_io_u[2],
+					(unsigned long long) ts->short_io_u[3],
 					(unsigned long long) ts->drop_io_u[0],
 					(unsigned long long) ts->drop_io_u[1],
-					(unsigned long long) ts->drop_io_u[2]);
+					(unsigned long long) ts->drop_io_u[2],
+					(unsigned long long) ts->drop_io_u[3]);
 	if (ts->continue_on_error) {
 		log_buf(out, "     errors    : total=%llu, first_error=%d/<%s>\n",
 					(unsigned long long)ts->total_err_count,
@@ -1442,6 +1445,8 @@ static void show_thread_status_terse_all(struct thread_stat *ts,
 	/* Log Trim Status */
 	if (ver == 2 || ver == 4 || ver == 5)
 		show_ddir_status_terse(ts, rs, DDIR_TRIM, ver, out);
+	/* Log Copy Status */
+	show_ddir_status_terse(ts, rs, DDIR_COPY, ver, out);
 
 	/* CPU Usage */
 	if (ts->total_run_time) {
@@ -1545,6 +1550,7 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts,
 	add_ddir_status_json(ts, rs, DDIR_READ, root);
 	add_ddir_status_json(ts, rs, DDIR_WRITE, root);
 	add_ddir_status_json(ts, rs, DDIR_TRIM, root);
+	add_ddir_status_json(ts, rs, DDIR_COPY, root);
 	add_ddir_status_json(ts, rs, DDIR_SYNC, root);
 
 	/* CPU Usage */
@@ -2325,6 +2331,8 @@ int __show_running_run_stats(void)
 			td->ts.runtime[DDIR_WRITE] += rt[i];
 		if (td_trim(td) && td->ts.io_bytes[DDIR_TRIM])
 			td->ts.runtime[DDIR_TRIM] += rt[i];
+		if (td_copy(td) && td->ts.io_bytes[DDIR_COPY])
+			td->ts.runtime[DDIR_COPY] += rt[i];
 	}
 
 	for_each_td(td, i) {
@@ -2346,6 +2354,8 @@ int __show_running_run_stats(void)
 			td->ts.runtime[DDIR_WRITE] -= rt[i];
 		if (td_trim(td) && td->ts.io_bytes[DDIR_TRIM])
 			td->ts.runtime[DDIR_TRIM] -= rt[i];
+		if (td_copy(td) && td->ts.io_bytes[DDIR_COPY])
+			td->ts.runtime[DDIR_COPY] -= rt[i];
 	}
 
 	free(rt);
diff --git a/stat.h b/stat.h
index 6dd5ef74..3d439e24 100644
--- a/stat.h
+++ b/stat.h
@@ -281,7 +281,6 @@ struct thread_stat {
 	uint32_t m_iops[DDIR_RWDIR_CNT];				\
 	uint32_t t_iops[DDIR_RWDIR_CNT];				\
 	uint32_t iops[DDIR_RWDIR_CNT];					\
-	uint32_t pad;							\
 	uint64_t elapsed_sec;						\
 	uint64_t eta_sec;						\
 	uint32_t is_pow2;						\
-- 
2.17.1



  parent reply	other threads:[~2020-12-01 11:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20201201114048epcas5p3e12de26128ce442bbe8406082eaccde9@epcas5p3.samsung.com>
2020-12-01 11:40 ` [PATCH 0/9] v1 Patchset : Simple Copy Command support Krishna Kanth Reddy
2020-12-01 11:40   ` [PATCH 1/9] Adding the necessary ddir changes to introduce copy operation Krishna Kanth Reddy
2020-12-01 11:40   ` [PATCH 2/9] Introducing new offsets for the " Krishna Kanth Reddy
2020-12-01 11:40   ` Krishna Kanth Reddy [this message]
2020-12-01 11:40   ` [PATCH 4/9] Adding a new " Krishna Kanth Reddy
2020-12-01 11:40   ` [PATCH 5/9] Added the changes for copy operation support in FIO Krishna Kanth Reddy
2020-12-01 11:40   ` [PATCH 6/9] New ioctl based synchronous IO engine. Only supports copy command Krishna Kanth Reddy
2020-12-01 11:40   ` [PATCH 7/9] Example configuration for simple " Krishna Kanth Reddy
2020-12-01 11:40   ` [PATCH 8/9] Support copy operation for zoned block devices Krishna Kanth Reddy
2020-12-01 12:11     ` Damien Le Moal
2020-12-10 14:14       ` Krishna Kanth Reddy
2020-12-11  0:37         ` Damien Le Moal
2020-12-01 11:40   ` [PATCH 9/9] Add a new test case to test the copy operation Krishna Kanth Reddy

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=20201201114034.8307-4-krish.reddy@samsung.com \
    --to=krish.reddy@samsung.com \
    --cc=ankit.kumar@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.