[CRIU] [PATCH 7/7] Refactor time accounting macros

Abhishek Dubey dubeyabhishek777 at gmail.com
Sun Aug 25 04:58:21 MSK 2019


refactoring time macros as per read mode
pre-dump design.

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

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);
 }
 
-- 
2.7.4



More information about the CRIU mailing list