[libvirt] [PATCH] virsh: fixed incorrect timing report

When executing virsh -t <command> the reported timing was off by 3 orders of magnitude if the command took more than one second. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- tools/virsh.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 7a5b92c..04d1b52 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1509,7 +1509,7 @@ vshCommandRun(vshControl *ctl, const vshCmd *cmd) return ret; if (enable_timing) { - double diff_ms = (((after.tv_sec - before.tv_sec) * 1000000.0) + + double diff_ms = (((after.tv_sec - before.tv_sec) * 1000.0) + ((after.tv_usec - before.tv_usec) / 1000.0)); vshPrint(ctl, _("\n(Time: %.3f ms)\n\n"), diff_ms); -- 1.7.0.4

On Fri, Aug 31, 2012 at 13:32:45 +0200, Viktor Mihajlovski wrote:
When executing virsh -t <command> the reported timing was off by 3 orders of magnitude if the command took more than one second.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- tools/virsh.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index 7a5b92c..04d1b52 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1509,7 +1509,7 @@ vshCommandRun(vshControl *ctl, const vshCmd *cmd) return ret;
if (enable_timing) { - double diff_ms = (((after.tv_sec - before.tv_sec) * 1000000.0) + + double diff_ms = (((after.tv_sec - before.tv_sec) * 1000.0) + ((after.tv_usec - before.tv_usec) / 1000.0));
vshPrint(ctl, _("\n(Time: %.3f ms)\n\n"), diff_ms);
ACK Jirka

On Fri, Aug 31, 2012 at 01:42:00PM +0200, Jiri Denemark wrote:
On Fri, Aug 31, 2012 at 13:32:45 +0200, Viktor Mihajlovski wrote:
When executing virsh -t <command> the reported timing was off by 3 orders of magnitude if the command took more than one second.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- tools/virsh.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index 7a5b92c..04d1b52 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1509,7 +1509,7 @@ vshCommandRun(vshControl *ctl, const vshCmd *cmd) return ret;
if (enable_timing) { - double diff_ms = (((after.tv_sec - before.tv_sec) * 1000000.0) + + double diff_ms = (((after.tv_sec - before.tv_sec) * 1000.0) + ((after.tv_usec - before.tv_usec) / 1000.0));
vshPrint(ctl, _("\n(Time: %.3f ms)\n\n"), diff_ms);
ACK
Pushed :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel Veillard
-
Jiri Denemark
-
Viktor Mihajlovski