[CRIU] [PATCH 6/8] Refactor time accounting macros

Abhishek Dubey dubeyabhishek777 at gmail.com
Thu Oct 3 17:09:23 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   | 7 +++++--
 criu/page-xfer.c | 8 ++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 23399a9..8aabb85 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1515,11 +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_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 ac1cca0..ff7c620 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -831,6 +831,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;
@@ -852,6 +854,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++) {
 
@@ -882,9 +887,12 @@ int page_xfer_predump_pages(int pid, struct page_xfer *xfer,
 			}
 		}
 
+		timing_stop(TIME_MEMWRITE);
 	}
 
 	munmap(userbuf, BUFFER_SIZE);
+	timing_start(TIME_MEMWRITE);
+
 	return dump_holes(xfer, pp, &cur_hole, NULL);
 }
 
-- 
2.7.4



More information about the CRIU mailing list