From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUNDz-00020R-7G for qemu-devel@nongnu.org; Mon, 22 Apr 2013 16:20:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUNDx-0006QT-Qi for qemu-devel@nongnu.org; Mon, 22 Apr 2013 16:20:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUNDx-0006Q6-H0 for qemu-devel@nongnu.org; Mon, 22 Apr 2013 16:20:29 -0400 Message-ID: <51759B89.5040107@redhat.com> Date: Mon, 22 Apr 2013 14:20:25 -0600 From: Eric Blake MIME-Version: 1.0 References: <1366579081-6857-1-git-send-email-mrhines@linux.vnet.ibm.com> <1366579081-6857-5-git-send-email-mrhines@linux.vnet.ibm.com> In-Reply-To: <1366579081-6857-5-git-send-email-mrhines@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2QAQRIIDTFPTSHFFMLLXA" Subject: Re: [Qemu-devel] [PATCH v5 04/12] rdma: introduce qemu_get_max_size() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mrhines@linux.vnet.ibm.com Cc: aliguori@us.ibm.com, quintela@redhat.com, qemu-devel@nongnu.org, owasserm@redhat.com, abali@us.ibm.com, mrhines@us.ibm.com, gokul@us.ibm.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2QAQRIIDTFPTSHFFMLLXA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/21/2013 03:17 PM, mrhines@linux.vnet.ibm.com wrote: > From: "Michael R. Hines" >=20 > This functions allows you to perform your own per-QEMUFileOps > calculation for the value of 'max_size'. >=20 > For RDMA, this calculation artificially limits migration throughput > and needs to be done differently for high-throughput links. >=20 > Signed-off-by: Michael R. Hines > --- > =20 > +size_t qemu_get_max_size(QEMUFile *f, uint64_t transferred_bytes, > + uint64_t time_spent, uint64_t max_downtime) > +{ > + if (time_spent) { > + mbps =3D (((double) transferred_bytes * 8.0) /=20 > + ((double) time_spent / 1000.0)) / 1000.0 / 1000.0; > + } else { > + mbps =3D -1.0; > + } > + > + if (f->ops->get_max_size) { > + return f->ops->get_max_size(f, f->opaque,=20 > + transferred_bytes, time_spent, max_downtime); > + } > + > + return ((double) (transferred_bytes / time_spent)) *=20 > + max_downtime / 1000000; Cast to double is too late; you've already suffered from integer division truncation when you compute (transferred_bytes/time_spent). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2QAQRIIDTFPTSHFFMLLXA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRdZuJAAoJEKeha0olJ0NqId0H/2UQ4Hpm68ztGNl4mRuOUMgY KhHFlFlZo5aM4kNsWrqtkPBRR1pCXdLaAkQ9HDWue57Hj6Z7nrMDPdXsYsZDgOJo 15J+60OCHfeLwCOzxn1ueF4FAz0SrlbvIa8Ex31jT93pwIQel4uH9TMvO0V4yiG3 TmTpN9IdwyhAfrlvwRJA598BpmxMrtFha9x6MRa6mozPwUyD1PX8wwyR+Kr0Ygcm afR+vbbvglKKmrE4Z9WhIlFoHH3jcWwVLLRB7JKK/Ac1Ok3gbUp7MNtqu4ls8nwO QNBYaPsz7Wp8DEUTlbsQIrCY8v8clIouGrdn1l1TKnN1WeULTPU6LKH2ek6iuH0= =pKrY -----END PGP SIGNATURE----- ------enig2QAQRIIDTFPTSHFFMLLXA--