[PATCH v2 2/3] migration: HMP: Fix postcopy latency distribution label

Fabiano Rosas posted 3 patches 4 months ago
Maintainers: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>
[PATCH v2 2/3] migration: HMP: Fix postcopy latency distribution label
Posted by Fabiano Rosas 4 months ago
Fix the loop condition to avoid having a label with "1000 us" instead
of "1 ms".

Reported-by: Prasad Pandit <ppandit@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 migration/migration-hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index bb954881d7..a8b879c9d6 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -57,7 +57,7 @@ static const gchar *format_time_str(uint64_t us)
     const char *units[] = {"us", "ms", "sec"};
     int index = 0;
 
-    while (us > 1000 && index + 1 < ARRAY_SIZE(units)) {
+    while (us >= 1000 && index + 1 < ARRAY_SIZE(units)) {
         us /= 1000;
         index++;
     }
-- 
2.35.3
Re: [PATCH v2 2/3] migration: HMP: Fix postcopy latency distribution label
Posted by Philippe Mathieu-Daudé 4 months ago
On 16/7/25 20:26, Fabiano Rosas wrote:
> Fix the loop condition to avoid having a label with "1000 us" instead
> of "1 ms".
> 
> Reported-by: Prasad Pandit <ppandit@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   migration/migration-hmp-cmds.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Good catch.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>