[7/9] Refactor time accounting macros

Submitted by Abhishek Dubey on Sept. 22, 2019, 4:24 a.m.

Details

Message ID 1569126298-23300-8-git-send-email-dubeyabhishek777@gmail.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Abhishek Dubey Sept. 22, 2019, 4:24 a.m.
refactoring time macros as per read mode
pre-dump design.

Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
---
 criu/cr-dump.c   | 8 +++++---
 criu/page-xfer.c | 7 +++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 23399a9..f025e2f 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1515,12 +1515,14 @@  static int cr_pre_dump_finish(int status)
 
 		mem_pp = dmpi(item)->mem_pp;
 
-		if (opts.pre_dump_mode == PRE_DUMP_READ)
+		if (opts.pre_dump_mode == PRE_DUMP_READ) {
+			timing_start(TIME_MEMWRITE);
 			ret = page_xfer_predump_pages(item->pid->real,
 							&xfer, mem_pp);
-		else
+		}
+		else {
 			ret = page_xfer_dump_pages(&xfer, mem_pp);
-
+		}
 		xfer.close(&xfer);
 
 		if (ret)
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index 1eeee5a..b077000 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -824,6 +824,8 @@  int page_xfer_predump_pages(int pid, struct page_xfer *xfer,
 
 	list_for_each_entry(ppb, &pp->bufs, l) {
 
+		timing_start(TIME_MEMDUMP);
+
 		aux_len = 0;
 		bufvec.iov_len = BUFFER_SIZE;
 		bufvec.iov_base = userbuf;
@@ -845,6 +847,9 @@  int page_xfer_predump_pages(int pid, struct page_xfer *xfer,
 			return -1;
 		}
 
+		timing_stop(TIME_MEMDUMP);
+		timing_start(TIME_MEMWRITE);
+
 		/* generating pagemap */
 		for (i = 0; i < aux_len; i++) {
 
@@ -875,9 +880,11 @@  int page_xfer_predump_pages(int pid, struct page_xfer *xfer,
 			}
 		}
 
+		timing_stop(TIME_MEMWRITE);
 	}
 
 	xfree(userbuf);
+	timing_start(TIME_MEMWRITE);
 	return dump_holes(xfer, pp, &cur_hole, NULL);
 }