[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 08/21] migration: Move setup_time to mig_stats
From: |
Juan Quintela |
Subject: |
Re: [PATCH 08/21] migration: Move setup_time to mig_stats |
Date: |
Mon, 15 May 2023 13:23:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Cédric Le Goater <clg@kaod.org> wrote:
> On 5/8/23 15:08, Juan Quintela wrote:
>> It is a time that needs to be cleaned each time cancel migration.
>> Once there ccreate calculate_time_since() to calculate how time since
>> a time in the past.
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>> migration/migration-stats.c | 7 +++++++
>> migration/migration-stats.h | 14 ++++++++++++++
>> migration/migration.c | 9 ++++-----
>> migration/migration.h | 1 -
>> 4 files changed, 25 insertions(+), 6 deletions(-)
>> diff --git a/migration/migration-stats.c
>> b/migration/migration-stats.c
>> index 2f2cea965c..5278c6c821 100644
>> --- a/migration/migration-stats.c
>> +++ b/migration/migration-stats.c
>> @@ -12,6 +12,13 @@
>> #include "qemu/osdep.h"
>> #include "qemu/stats64.h"
>> +#include "qemu/timer.h"
>> #include "migration-stats.h"
>> MigrationAtomicStats mig_stats;
>> +
>> +void calculate_time_since(Stat64 *val, int64_t since)
>> +{
>> + int64_t now = qemu_clock_get_ms(QEMU_CLOCK_HOST);
>> + stat64_set(val, now - since);
>> +}
>> diff --git a/migration/migration-stats.h b/migration/migration-stats.h
>> index cf8a4f0410..73c73d75b9 100644
>> --- a/migration/migration-stats.h
>> +++ b/migration/migration-stats.h
>> @@ -69,6 +69,10 @@ typedef struct {
>> * Number of bytes sent during precopy stage.
>> */
>> Stat64 precopy_bytes;
>> + /*
>> + * How long has the setup stage took.
>> + */
>> + Stat64 setup_time;
>> /*
>> * Total number of bytes transferred.
>> */
>> @@ -81,4 +85,14 @@ typedef struct {
>> extern MigrationAtomicStats mig_stats;
>> +/**
>> + * calculate_time_since: Calculate how much time has passed
>> + *
>> + * @val: stat64 where to store the time
>> + * @since: reference time since we want to calculate
>> + *
>> + * Returns: Nothing. The time is stored in val.
>> + */
>> +
>> +void calculate_time_since(Stat64 *val, int64_t since);
>
> Since this routine is in the "migration" namespace, I would rename it to
>
> void migration_time_since(Stat64 *val, int64_t since);
>
> of even
>
> void migration_time_since(MigrationAtomicStats *stat, int64_t since);
>
> Do you need it elsewhere than in migration.c ?
Not yet.
I can change to this and later change if needed.
Thanks, Juan.
- Re: [PATCH 10/21] migration: Move rate_limit_max and rate_limit_used to migration_stats, (continued)
[PATCH 07/21] migration: Correct transferred bytes value, Juan Quintela, 2023/05/08
[PATCH 08/21] migration: Move setup_time to mig_stats, Juan Quintela, 2023/05/08
[PATCH 09/21] qemu-file: Account for rate_limit usage on qemu_fflush(), Juan Quintela, 2023/05/08
[PATCH 11/21] migration: Move migration_total_bytes() to migration-stats.c, Juan Quintela, 2023/05/08
[PATCH 15/21] migration: Don't abuse qemu_file transferred for RDMA, Juan Quintela, 2023/05/08
[PATCH 18/21] migration/rdma: Don't use imaginary transfers, Juan Quintela, 2023/05/08
[PATCH 12/21] migration: Add a trace for migration_transferred_bytes, Juan Quintela, 2023/05/08
[PATCH 13/21] migration: Use migration_transferred_bytes() to calculate rate_limit, Juan Quintela, 2023/05/08