To facilitate understanding of what constitutes downtime, add a tracepoint that gives the downtime breakdown throughout all steps of switchover.
Signed-off-by: Joao Martins <[email protected]> --- migration/migration.c | 34 ++++++++++++++++++++++++++++++++++ migration/trace-events | 1 + 2 files changed, 35 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index d06840024a1e..4b5bed3eb09b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -893,6 +893,34 @@ static bool migrate_show_downtime(MigrationState *s) return (s->state == MIGRATION_STATUS_COMPLETED) || migration_in_postcopy(); } +static int64_t migrate_get_downtime_stop(MigrationState *s) +{ + return migration_get_timestamp(MIGRATION_DOWNTIME_STOP) - + migration_get_timestamp(MIGRATION_DOWNTIME_START); +} + +static int64_t migrate_get_downtime_precopy_iterable(MigrationState *s) +{ + return migration_get_timestamp(MIGRATION_DOWNTIME_PRECOPY_ITERABLE) - + migration_get_timestamp(MIGRATION_DOWNTIME_STOP); +} + +static int64_t migrate_get_downtime_precopy_noniterable(MigrationState *s) +{ + return migration_get_timestamp(MIGRATION_DOWNTIME_PRECOPY_NONITERABLE) - + migration_get_timestamp(MIGRATION_DOWNTIME_PRECOPY_ITERABLE); +} + +static int64_t migrate_get_downtime_resume_rp(MigrationState *s) +{ + if (migrate_return_path()) { + return migration_get_timestamp(MIGRATION_DOWNTIME_RESUME_RETURN_PATH) - + migration_get_timestamp(MIGRATION_DOWNTIME_PRECOPY_NONITERABLE); + } + + return 0; +} + static void populate_time_info(MigrationInfo *info, MigrationState *s) { info->has_status = true; @@ -2689,6 +2717,12 @@ static void migration_calculate_complete(MigrationState *s) * postcopy, downtime is calculated during postcopy_start(). */ s->downtime = end_time - migration_get_timestamp(MIGRATION_DOWNTIME_START); + + trace_source_downtime_stats(s->downtime, + migrate_get_downtime_stop(s), + migrate_get_downtime_precopy_iterable(s), + migrate_get_downtime_precopy_noniterable(s), + migrate_get_downtime_resume_rp(s)); } transfer_time = s->total_time - s->setup_time; diff --git a/migration/trace-events b/migration/trace-events index 4666f19325e7..163dc74bc49a 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -189,6 +189,7 @@ migrate_transferred(uint64_t transferred, uint64_t time_spent, uint64_t bandwidt process_incoming_migration_co_end(int ret, int ps) "ret=%d postcopy-state=%d" process_incoming_migration_co_postcopy_end_main(void) "" postcopy_preempt_enabled(bool value) "%d" +source_downtime_stats(int64_t downtime, int64_t stop, int64_t iterable, int64_t non_iterable, int64_t resume_rp) "downtime %"PRIi64": stop %"PRIi64" iterable %"PRIi64" non_iterable %"PRIi64" resume-rp %"PRIi64 # migration-stats migration_transferred_bytes(uint64_t qemu_file, uint64_t multifd) "qemu_file %" PRIu64 " multifd %" PRIu64 -- 2.39.3
