qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 04/12] rdma: introduce qemu_get_max_size()


From: Michael R. Hines
Subject: Re: [Qemu-devel] [PATCH v5 04/12] rdma: introduce qemu_get_max_size()
Date: Mon, 22 Apr 2013 16:59:13 -0400
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

On 04/22/2013 04:20 PM, Eric Blake wrote:
On 04/21/2013 03:17 PM, address@hidden wrote:
From: "Michael R. Hines" <address@hidden>

This functions allows you to perform your own per-QEMUFileOps
calculation for the value of 'max_size'.

For RDMA, this calculation artificially limits migration throughput
and needs to be done differently for high-throughput links.

Signed-off-by: Michael R. Hines <address@hidden>
---
+size_t qemu_get_max_size(QEMUFile *f, uint64_t transferred_bytes,
+                         uint64_t time_spent, uint64_t max_downtime)
+{
+    if (time_spent) {
+        mbps = (((double) transferred_bytes * 8.0) /
+            ((double) time_spent / 1000.0)) / 1000.0 / 1000.0;
+    } else {
+        mbps = -1.0;
+    }
+
+    if (f->ops->get_max_size) {
+        return f->ops->get_max_size(f, f->opaque,
+            transferred_bytes, time_spent, max_downtime);
+    }
+
+    return ((double) (transferred_bytes / time_spent)) *
+                    max_downtime / 1000000;
Cast to double is too late; you've already suffered from integer
division truncation when you compute (transferred_bytes/time_spent).


Good catch, thank you.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]