[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 09/11] migration: cleanup stats update into func
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH 09/11] migration: cleanup stats update into function |
Date: |
Wed, 03 Jan 2018 11:08:49 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Peter Xu <address@hidden> wrote:
> We have quite a few lines in migration_thread() that calculates some
> statistics for the migration interations. Isolate it into a single
> function to improve readability.
>
> Signed-off-by: Peter Xu <address@hidden>
> +static void migration_update_statistics(MigrationState *s,
migration_update_counters()?
statistics for me mean that they are only used for informative
purposes. Here we *act* on that values.
>
> - qemu_file_reset_rate_limit(s->to_dst_file);
> - initial_time = current_time;
> - initial_bytes = qemu_ftell(s->to_dst_file);
> - }
> + /* Conditionally update statistics */
No need for the comment. If we think it is needed just rename the
function to:
conditionally_update_statistics()?
I still preffer the:
migration_update_counters.
> diff --git a/migration/migration.h b/migration/migration.h
> index 3ab5506233..248f7d9a5c 100644
> --- a/migration/migration.h
> +++ b/migration/migration.h
> @@ -90,6 +90,19 @@ struct MigrationState
> QEMUBH *cleanup_bh;
> QEMUFile *to_dst_file;
>
> + /*
> + * Migration thread statistic variables, mostly used in
> + * migration_thread() iterations only.
> + */
> + uint64_t initial_bytes;
/* bytes already send at the beggining of current interation */
uint64_t iteration_initial_bytes;
> + int64_t initial_time;
/* time at the start of current iteration */
int64_t iteration_start_time;
What do you think?
> + /*
> + * The final stage happens when the remaining data is smaller than
> + * this threshold; it's calculated from the requested downtime and
> + * measured bandwidth
> + */
> + int64_t threshold_size;
> +
> /* params from 'migrate-set-parameters' */
> MigrationParameters parameters;
Later, Juan.