Commit 2df39a4b authored by Pavel Emelyanov's avatar Pavel Emelyanov

stats: Account for time to fork tasks on restore

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c65f0684
......@@ -1324,13 +1324,18 @@ static int restore_root_task(struct pstree_item *init)
if (ret)
goto out;
timing_start(TIME_FORK);
__restore_switch_stage(CR_STATE_FORKING);
pr_info("Wait until all tasks are forked\n");
ret = restore_switch_stage(CR_STATE_RESTORE_PGID);
if (ret < 0)
ret = restore_wait_inprogress_tasks();
if (ret)
goto out;
timing_stop(TIME_FORK);
__restore_switch_stage(CR_STATE_RESTORE_PGID);
pr_info("Wait until all tasks restored pgid\n");
ret = restore_switch_stage(CR_STATE_RESTORE);
......
......@@ -12,6 +12,8 @@ enum {
};
enum {
TIME_FORK,
RESTORE_TIME_NS_STATS,
};
......
......@@ -13,6 +13,8 @@ message dump_stats_entry {
message restore_stats_entry {
required uint64 pages_compared = 1;
required uint64 pages_skipped_cow = 2;
required uint32 forking_time = 3;
}
message stats_entry {
......
......@@ -97,7 +97,10 @@ void show_stats(int fd)
static void encode_time(int t, u_int32_t *to)
{
*to = dstats->timings[t].total.tv_sec * USEC_PER_SEC + dstats->timings[t].total.tv_usec;
struct timing *tm;
tm = get_timing(t);
*to = tm->total.tv_sec * USEC_PER_SEC + tm->total.tv_usec;
}
void write_stats(int what)
......@@ -128,6 +131,8 @@ void write_stats(int what)
rs_entry.pages_compared = atomic_get(&rstats->counts[CNT_PAGES_COMPARED]);
rs_entry.pages_skipped_cow = atomic_get(&rstats->counts[CNT_PAGES_SKIPPED_COW]);
encode_time(TIME_FORK, &rs_entry.forking_time);
name = "restore";
} 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