[7/7] Refactor time accounting macros

Submitted by Abhishek Dubey on Aug. 25, 2019, 1:58 a.m.

Details

Message ID 1566698301-8740-8-git-send-email-dubeyabhishek777@gmail.com
State New
Series "GSoC 19: Optimizing the Pre-dump Algorithm"
Headers show

Commit Message

Abhishek Dubey Aug. 25, 2019, 1:58 a.m.
refactoring time macros as per read mode
pre-dump design.

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

Patch hide | download patch | download mbox

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 7732093..b916e0a 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1514,11 +1514,13 @@  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_stop(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);
 
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index 8f2bc80..3adf930 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -827,6 +827,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 = sizeof(userbuf);
 		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++) {
 
@@ -867,8 +872,11 @@  int page_xfer_predump_pages(int pid, struct page_xfer *xfer,
 			if (xfer->write_pages(xfer, ppb->p[0], iov.iov_len))
 				return -1;
 		}
+
+		timing_stop(TIME_MEMWRITE);
         }
 
+	timing_start(TIME_MEMWRITE);
 	return dump_holes(xfer, pp, &cur_hole, NULL);
 }