From patchwork Mon Jan 22 11:36:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Wei W" X-Patchwork-Id: 10178321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2E5E5600F5 for ; Mon, 22 Jan 2018 11:55:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0ACAF20952 for ; Mon, 22 Jan 2018 11:55:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F186526212; Mon, 22 Jan 2018 11:55:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50F1220952 for ; Mon, 22 Jan 2018 11:55:36 +0000 (UTC) Received: from localhost ([::1]:37716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edahL-0008Lo-Bx for patchwork-qemu-devel@patchwork.kernel.org; Mon, 22 Jan 2018 06:55:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edagi-0007wq-7r for qemu-devel@nongnu.org; Mon, 22 Jan 2018 06:54:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edagf-0002TD-6y for qemu-devel@nongnu.org; Mon, 22 Jan 2018 06:54:56 -0500 Received: from mga06.intel.com ([134.134.136.31]:46677) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edage-0002SK-UT for qemu-devel@nongnu.org; Mon, 22 Jan 2018 06:54:53 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2018 03:54:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,396,1511856000"; d="scan'208";a="168094350" Received: from devel-ww.sh.intel.com ([10.239.48.110]) by orsmga004.jf.intel.com with ESMTP; 22 Jan 2018 03:54:50 -0800 From: Wei Wang To: qemu-devel@nongnu.org, peterx@redhat.com, quintela@redhat.com, dgilbert@redhat.com Date: Mon, 22 Jan 2018 19:36:39 +0800 Message-Id: <1516620999-25669-1-git-send-email-wei.w.wang@intel.com> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.31 Subject: [Qemu-devel] [PATCH v2] migration: use s->threshold_size inside migration_update_counters X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wei Wang Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Fixes: b15df1ae50 ("migration: cleanup stats update into function") The threshold size is changed to be recorded in s->threshold_size. Signed-off-by: Wei Wang Reviewed-by: Peter Xu Reviewed-by: Juan Quintela --- migration/migration.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) v1->v2 change: only commit log description change diff --git a/migration/migration.c b/migration/migration.c index d3a1c49..bfd1a16 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2212,7 +2212,6 @@ static void migration_update_counters(MigrationState *s, int64_t current_time) { uint64_t transferred, time_spent; - int64_t threshold_size; double bandwidth; if (current_time < s->iteration_start_time + BUFFER_DELAY) { @@ -2222,7 +2221,7 @@ static void migration_update_counters(MigrationState *s, transferred = qemu_ftell(s->to_dst_file) - s->iteration_initial_bytes; time_spent = current_time - s->iteration_start_time; bandwidth = (double)transferred / time_spent; - threshold_size = bandwidth * s->parameters.downtime_limit; + s->threshold_size = bandwidth * s->parameters.downtime_limit; s->mbps = (((double) transferred * 8.0) / ((double) time_spent / 1000.0)) / 1000.0 / 1000.0; @@ -2242,7 +2241,7 @@ static void migration_update_counters(MigrationState *s, s->iteration_initial_bytes = qemu_ftell(s->to_dst_file); trace_migrate_transferred(transferred, time_spent, - bandwidth, threshold_size); + bandwidth, s->threshold_size); } /* Migration thread iteration status */