Commit d770f4ef authored by Pavel Emelyanov's avatar Pavel Emelyanov

stats: Protobuf file introduction introduction

We'll have one more "image" file generated by dump and (surprisingly)
restore commands -- the stats one. It will contain in a single pb
object all the statistics collected by dump/restore.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e75148dc
......@@ -46,6 +46,7 @@ obj-y += page-pipe.o
obj-y += page-xfer.o
obj-y += page-read.o
obj-y += kerndat.o
obj-y += stats.o
ifneq ($(MAKECMDGOALS),clean)
incdeps := y
......
......@@ -13,6 +13,7 @@
#include "mount.h"
#include "net.h"
#include "pstree.h"
#include "stats.h"
#include "protobuf.h"
#include "protobuf/inventory.pb-c.h"
#include "protobuf/pagemap.pb-c.h"
......@@ -167,6 +168,12 @@ struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = {
FD_ENTRY(SHM_PAGES_OLD, "pages-shmem-%ld", NULL),
FD_ENTRY(SIGNAL, "signal-s-%d", show_siginfo), /* shared signals */
FD_ENTRY(PSIGNAL, "signal-p-%d", show_siginfo), /* private signals */
[CR_FD_STATS] = {
.fmt = "stats-%s",
.magic = STATS_MAGIC,
.show = show_stats,
},
};
static struct cr_fdset *alloc_cr_fdset(int nr)
......
......@@ -16,6 +16,7 @@
enum {
CR_FD_INVENTORY,
CR_FD_STATS,
/*
* Task entries
*/
......
......@@ -21,6 +21,7 @@
#define INVENTORY_MAGIC 0x58313116 /* Veliky Novgorod */
#define PSTREE_MAGIC 0x50273030 /* Kyiv */
#define STATS_MAGIC 0x57093306 /* Ostashkov */
#define FDINFO_MAGIC 0x56213732 /* Dmitrov */
#define PAGEMAP_MAGIC 0x56084025 /* Vladimir */
#define SHMEM_PAGEMAP_MAGIC PAGEMAP_MAGIC
......
......@@ -7,6 +7,7 @@
enum {
PB_INVENTORY,
PB_STATS,
PB_FDINFO,
PB_CORE,
PB_MM,
......
#ifndef __CR_STATS_H__
#define __CR_STATS_H__
void show_stats(int fd);
#endif
......@@ -18,6 +18,7 @@
#include "protobuf.h"
#include "protobuf/inventory.pb-c.h"
#include "protobuf/stats.pb-c.h"
#include "protobuf/regfile.pb-c.h"
#include "protobuf/eventfd.pb-c.h"
#include "protobuf/eventpoll.pb-c.h"
......@@ -93,6 +94,7 @@ static struct cr_pb_message_desc cr_pb_descs[PB_MAX];
void cr_pb_init(void)
{
CR_PB_DESC(INVENTORY, Inventory, inventory);
CR_PB_DESC(STATS, Stats, stats);
CR_PB_DESC(FDINFO, Fdinfo, fdinfo);
CR_PB_DESC(REG_FILES, RegFile, reg_file);
CR_PB_DESC(EVENTFD, EventfdFile, eventfd_file);
......
......@@ -9,6 +9,7 @@
CFLAGS += -I$(obj)/
proto-obj-y += stats.o
proto-obj-y += core.o
proto-obj-y += core-x86.o
proto-obj-y += core-arm.o
......
// This one contains statistics about dump/restore process
message dump_stats_entry {
}
message stats_entry {
optional dump_stats_entry dump = 1;
}
#include <unistd.h>
#include "protobuf.h"
#include "stats.h"
void show_stats(int fd)
{
pb_show_vertical(fd, PB_STATS);
}
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