[Pkg-libvirt-commits] [libguestfs] 36/179: v2v: Print virtual and real copying rates.
Hilko Bengen
bengen at moszumanska.debian.org
Fri Oct 31 19:08:03 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch experimental
in repository libguestfs.
commit 36ce0e65f693b21a1557086f10fd49be40da720d
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Wed Oct 8 20:21:36 2014 +0100
v2v: Print virtual and real copying rates.
Useful to diagnose speed issues in the qemu block drivers.
---
v2v/v2v.ml | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 1da890b..d4ba0c4 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -337,14 +337,32 @@ let rec main () =
(quote t.target_format) (quote overlay_file)
(quote t.target_file) in
if verbose then printf "%s\n%!" cmd;
+ let start_time = gettimeofday () in
if Sys.command cmd <> 0 then
error (f_"qemu-img command failed, see earlier errors");
+ let end_time = gettimeofday () in
(* Calculate the actual size on the target, returns an updated
* target structure.
*)
let t = actual_target_size t in
+ (* If verbose, print the virtual and real copying rates. *)
+ let elapsed_time = end_time -. start_time in
+ if verbose && elapsed_time > 0. then (
+ let rate =
+ Int64.to_float t.target_overlay.ov_virtual_size
+ /. 1024. /. 1024. *. 10. /. elapsed_time in
+ printf "virtual copying rate: %.1f M bits/sec\n%!" rate;
+
+ match t.target_actual_size with
+ | None -> ()
+ | Some actual ->
+ let rate =
+ Int64.to_float actual /. 1024. /. 1024. *. 10. /. elapsed_time in
+ printf "real copying rate: %.1f M bits/sec\n%!" rate
+ );
+
(* If verbose, find out how close the estimate was. This is
* for developer information only - so we can increase the
* accuracy of the estimate.
@@ -362,7 +380,7 @@ let rec main () =
actual (human_size actual)
pc;
if pc < 0. then printf " ! ESTIMATE TOO LOW !";
- printf "\n";
+ printf "\n%!";
);
t
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list