mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
stats: Fix restore pages stats
We errorneously report nr_compared as total number of restored pages. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
b745ae83b3
commit
d8071ffd1a
4 changed files with 10 additions and 1 deletions
|
|
@ -324,6 +324,7 @@ static int restore_priv_vma_content(pid_t pid)
|
|||
unsigned int nr_restored = 0;
|
||||
unsigned int nr_shared = 0;
|
||||
unsigned int nr_droped = 0;
|
||||
unsigned int nr_compared = 0;
|
||||
unsigned long va;
|
||||
struct page_read pr;
|
||||
|
||||
|
|
@ -386,6 +387,8 @@ static int restore_priv_vma_content(pid_t pid)
|
|||
goto err_read;
|
||||
va += PAGE_SIZE;
|
||||
|
||||
nr_compared++;
|
||||
|
||||
if (memcmp(p, buf, PAGE_SIZE) == 0) {
|
||||
nr_shared++; /* the page is cowed */
|
||||
continue;
|
||||
|
|
@ -438,8 +441,9 @@ err_read:
|
|||
}
|
||||
}
|
||||
|
||||
cnt_add(CNT_PAGES_COMPARED, nr_restored + nr_shared);
|
||||
cnt_add(CNT_PAGES_COMPARED, nr_compared);
|
||||
cnt_add(CNT_PAGES_SKIPPED_COW, nr_shared);
|
||||
cnt_add(CNT_PAGES_RESTORED, nr_restored);
|
||||
|
||||
pr_info("nr_restored_pages: %d\n", nr_restored);
|
||||
pr_info("nr_shared_pages: %d\n", nr_shared);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ enum {
|
|||
enum {
|
||||
CNT_PAGES_COMPARED,
|
||||
CNT_PAGES_SKIPPED_COW,
|
||||
CNT_PAGES_RESTORED,
|
||||
|
||||
RESTORE_CNT_NR_STATS,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ message restore_stats_entry {
|
|||
|
||||
required uint32 forking_time = 3;
|
||||
required uint32 restore_time = 4;
|
||||
|
||||
optional uint64 pages_restored = 5;
|
||||
}
|
||||
|
||||
message stats_entry {
|
||||
|
|
|
|||
2
stats.c
2
stats.c
|
|
@ -128,6 +128,8 @@ void write_stats(int what)
|
|||
|
||||
rs_entry.pages_compared = atomic_read(&rstats->counts[CNT_PAGES_COMPARED]);
|
||||
rs_entry.pages_skipped_cow = atomic_read(&rstats->counts[CNT_PAGES_SKIPPED_COW]);
|
||||
rs_entry.has_pages_restored = true;
|
||||
rs_entry.pages_restored = atomic_read(&rstats->counts[CNT_PAGES_RESTORED]);
|
||||
|
||||
encode_time(TIME_FORK, &rs_entry.forking_time);
|
||||
encode_time(TIME_RESTORE, &rs_entry.restore_time);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue