Commit 37c13709 authored by Pavel Emelyanov's avatar Pavel Emelyanov

mem/stats: Add stats about memory dumping

pages_scanned -- the amount of pages criu looked at for decision
pages_skipped_parent -- the amount of pages that were skipped, due to
                        they are present in parent image
pages_writted -- the amount of pages criu transfered into image
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent abd61841
......@@ -14,6 +14,16 @@ enum {
void timing_start(int t);
void timing_stop(int t);
enum {
CNT_PAGES_SCANNED,
CNT_PAGES_SKIPPED_PARENT,
CNT_PAGES_WRITTEN,
CNT_NR_STATS,
};
void cnt_add(int c, unsigned long val);
#define DUMP_STATS 1
void write_stats(int what);
......
......@@ -251,6 +251,10 @@ static int generate_iovs(struct vma_area *vma, int pagemap, struct page_pipe *pp
return -1;
}
cnt_add(CNT_PAGES_SCANNED, nr_to_scan);
cnt_add(CNT_PAGES_SKIPPED_PARENT, pages[0]);
cnt_add(CNT_PAGES_WRITTEN, pages[1]);
pr_info("Pagemap generated: %lu pages %lu holes\n", pages[1], pages[0]);
return 0;
}
......
......@@ -4,6 +4,10 @@ message dump_stats_entry {
required uint32 frozen_time = 2;
required uint32 memdump_time = 3;
required uint32 memwrite_time = 4;
required uint64 pages_scanned = 5;
required uint64 pages_skipped_parent = 6;
required uint64 pages_written = 7;
}
message stats_entry {
......
......@@ -12,6 +12,14 @@ struct timing {
static struct timing timings[TIME_NR_STATS];
static unsigned long counts[CNT_NR_STATS];
void cnt_add(int c, unsigned long val)
{
BUG_ON(c >= CNT_NR_STATS);
counts[c] += val;
}
static void timeval_accumulate(const struct timeval *from, const struct timeval *to,
struct timeval *res)
{
......@@ -46,7 +54,8 @@ void timing_stop(int t)
void show_stats(int fd)
{
do_pb_show_plain(fd, PB_STATS, 1, NULL, "1.1:%u 1.2:%u 1.3:%u 1.4:%u");
do_pb_show_plain(fd, PB_STATS, 1, NULL,
"1.1:%u 1.2:%u 1.3:%u 1.4:%u 1.5:%Lu 1.6:%Lu 1.7:%Lu");
}
static void encode_time(int t, u_int32_t *to)
......@@ -70,6 +79,10 @@ void write_stats(int what)
encode_time(TIME_MEMDUMP, &dstats.memdump_time);
encode_time(TIME_MEMWRITE, &dstats.memwrite_time);
dstats.pages_scanned = counts[CNT_PAGES_SCANNED];
dstats.pages_skipped_parent = counts[CNT_PAGES_SKIPPED_PARENT];
dstats.pages_written = counts[CNT_PAGES_WRITTEN];
name = "dump";
} else
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment