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;