Commit bd1d6186 authored by Pavel Emelyanov's avatar Pavel Emelyanov

stats: Write dump stats after dump is finished

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent d770f4ef
......@@ -59,6 +59,7 @@
#include "file-lock.h"
#include "page-xfer.h"
#include "kerndat.h"
#include "stats.h"
#include "asm/dump.h"
......@@ -1638,8 +1639,10 @@ err:
if (ret) {
kill_inventory();
pr_err("Dumping FAILED.\n");
} else
} else {
write_stats(DUMP_STATS);
pr_info("Dumping finished successfully\n");
}
return ret;
}
#ifndef __CR_STATS_H__
#define __CR_STATS_H__
void show_stats(int fd);
#define DUMP_STATS 1
void write_stats(int what);
#endif
#include <unistd.h>
#include "protobuf.h"
#include "stats.h"
#include "crtools.h"
#include "protobuf/stats.pb-c.h"
void show_stats(int fd)
{
pb_show_vertical(fd, PB_STATS);
}
void write_stats(int what)
{
StatsEntry stats = STATS_ENTRY__INIT;
DumpStatsEntry dstats = DUMP_STATS_ENTRY__INIT;
char *name;
int fd;
pr_info("Writing stats\n");
if (what == DUMP_STATS) {
stats.dump = &dstats;
name = "dump";
} else
return;
fd = open_image(CR_FD_STATS, O_DUMP, name);
if (fd >= 0) {
pb_write_one(fd, &stats, PB_STATS);
close(fd);
}
}
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