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: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Andrei Vagin 2017-11-08 03:36:01 +03:00
parent 00413cb5a7
commit 7d6d795d28
5 changed files with 15 additions and 0 deletions

View file

@ -26,6 +26,8 @@ enum {
CNT_PAGES_SKIPPED_PARENT,
CNT_PAGES_WRITTEN,
CNT_PAGES_LAZY,
CNT_PAGE_PIPES,
CNT_PAGE_PIPE_BUFS,
DUMP_CNT_NR_STATS,
};

View file

@ -9,6 +9,7 @@
#include "criu-log.h"
#include "page-pipe.h"
#include "fcntl.h"
#include "stats.h"
/* can existing iov accumulate the page? */
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)
ppb = xmalloc(sizeof(*ppb));
if (!ppb)
return NULL;
cnt_add(CNT_PAGE_PIPE_BUFS, 1);
if (pipe(ppb->p)) {
xfree(ppb);
pr_perror("Can't make pipe for page-pipe");
return NULL;
}
cnt_add(CNT_PAGE_PIPES, 1);
ppb->pipe_size = fcntl(ppb->p[0], F_GETPIPE_SZ, 0) / PAGE_SIZE;
pp->nr_pipes++;

View file

@ -20,6 +20,7 @@
#include "pstree.h"
#include "parasite-syscall.h"
#include "rst_info.h"
#include "stats.h"
static int page_server_sk = -1;
@ -966,6 +967,9 @@ int cr_page_server(bool daemon_mode, bool lazy_dump, int cfd)
int sk = -1;
int ret;
if (init_stats(DUMP_STATS))
return -1;
if (!opts.lazy_pages)
up_page_ids_base();
else if (!lazy_dump)

View file

@ -160,6 +160,10 @@ void write_stats(int what)
ds_entry.pages_skipped_parent = dstats->counts[CNT_PAGES_SKIPPED_PARENT];
ds_entry.pages_written = dstats->counts[CNT_PAGES_WRITTEN];
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";
} else if (what == RESTORE_STATS) {

View file

@ -14,6 +14,8 @@ message dump_stats_entry {
optional uint32 irmap_resolve = 8;
required uint64 pages_lazy = 9;
optional uint64 page_pipes = 10;
optional uint64 page_pipe_bufs = 11;
}
message restore_stats_entry {