Commit 7d6d795d authored by Andrei Vagin's avatar Andrei Vagin

stats: add counters for pipes and page_pipe_bufs

The number of pipes are limited in a system, so it is better to know how
many we use.
Acked-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 00413cb5
...@@ -26,6 +26,8 @@ enum { ...@@ -26,6 +26,8 @@ enum {
CNT_PAGES_SKIPPED_PARENT, CNT_PAGES_SKIPPED_PARENT,
CNT_PAGES_WRITTEN, CNT_PAGES_WRITTEN,
CNT_PAGES_LAZY, CNT_PAGES_LAZY,
CNT_PAGE_PIPES,
CNT_PAGE_PIPE_BUFS,
DUMP_CNT_NR_STATS, DUMP_CNT_NR_STATS,
}; };
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "criu-log.h" #include "criu-log.h"
#include "page-pipe.h" #include "page-pipe.h"
#include "fcntl.h" #include "fcntl.h"
#include "stats.h"
/* can existing iov accumulate the page? */ /* can existing iov accumulate the page? */
static inline bool iov_grow_page(struct iovec *iov, unsigned long addr) static inline bool iov_grow_page(struct iovec *iov, unsigned long addr)
...@@ -34,12 +35,14 @@ static struct page_pipe_buf *ppb_alloc(struct page_pipe *pp) ...@@ -34,12 +35,14 @@ static struct page_pipe_buf *ppb_alloc(struct page_pipe *pp)
ppb = xmalloc(sizeof(*ppb)); ppb = xmalloc(sizeof(*ppb));
if (!ppb) if (!ppb)
return NULL; return NULL;
cnt_add(CNT_PAGE_PIPE_BUFS, 1);
if (pipe(ppb->p)) { if (pipe(ppb->p)) {
xfree(ppb); xfree(ppb);
pr_perror("Can't make pipe for page-pipe"); pr_perror("Can't make pipe for page-pipe");
return NULL; return NULL;
} }
cnt_add(CNT_PAGE_PIPES, 1);
ppb->pipe_size = fcntl(ppb->p[0], F_GETPIPE_SZ, 0) / PAGE_SIZE; ppb->pipe_size = fcntl(ppb->p[0], F_GETPIPE_SZ, 0) / PAGE_SIZE;
pp->nr_pipes++; pp->nr_pipes++;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "pstree.h" #include "pstree.h"
#include "parasite-syscall.h" #include "parasite-syscall.h"
#include "rst_info.h" #include "rst_info.h"
#include "stats.h"
static int page_server_sk = -1; static int page_server_sk = -1;
...@@ -966,6 +967,9 @@ int cr_page_server(bool daemon_mode, bool lazy_dump, int cfd) ...@@ -966,6 +967,9 @@ int cr_page_server(bool daemon_mode, bool lazy_dump, int cfd)
int sk = -1; int sk = -1;
int ret; int ret;
if (init_stats(DUMP_STATS))
return -1;
if (!opts.lazy_pages) if (!opts.lazy_pages)
up_page_ids_base(); up_page_ids_base();
else if (!lazy_dump) else if (!lazy_dump)
......
...@@ -160,6 +160,10 @@ void write_stats(int what) ...@@ -160,6 +160,10 @@ void write_stats(int what)
ds_entry.pages_skipped_parent = dstats->counts[CNT_PAGES_SKIPPED_PARENT]; ds_entry.pages_skipped_parent = dstats->counts[CNT_PAGES_SKIPPED_PARENT];
ds_entry.pages_written = dstats->counts[CNT_PAGES_WRITTEN]; ds_entry.pages_written = dstats->counts[CNT_PAGES_WRITTEN];
ds_entry.pages_lazy = dstats->counts[CNT_PAGES_LAZY]; ds_entry.pages_lazy = dstats->counts[CNT_PAGES_LAZY];
ds_entry.page_pipes = dstats->counts[CNT_PAGE_PIPES];
ds_entry.has_page_pipes = true;
ds_entry.page_pipe_bufs = dstats->counts[CNT_PAGE_PIPE_BUFS];
ds_entry.has_page_pipe_bufs = true;
name = "dump"; name = "dump";
} else if (what == RESTORE_STATS) { } else if (what == RESTORE_STATS) {
......
...@@ -14,6 +14,8 @@ message dump_stats_entry { ...@@ -14,6 +14,8 @@ message dump_stats_entry {
optional uint32 irmap_resolve = 8; optional uint32 irmap_resolve = 8;
required uint64 pages_lazy = 9; required uint64 pages_lazy = 9;
optional uint64 page_pipes = 10;
optional uint64 page_pipe_bufs = 11;
} }
message restore_stats_entry { message restore_stats_entry {
......
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