[6/8] Refactor time accounting macros

Submitted by Abhishek Dubey on Oct. 3, 2019, 2:09 p.m.

Details

Message ID 1570111765-19381-7-git-send-email-dubeyabhishek777@gmail.com
State Accepted
Series "Series without cover letter"
Commit b5e9eb508156025cfa39f53a694b4cb74ae77605
Headers show

Commit Message

Abhishek Dubey Oct. 3, 2019, 2:09 p.m.
refactoring time macros as per read mode
pre-dump design.

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

Patch hide | download patch | download mbox

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