On Mon, Jun 09, 2025 at 06:05:16PM -0400, Peter Xu wrote:
> On Mon, Jun 09, 2025 at 03:12:54PM -0400, Peter Xu wrote:
> > +static void migration_dump_blocktime(Monitor *mon, MigrationInfo *info)
> > +{
> > +    if (info->has_postcopy_blocktime) {
> > +        monitor_printf(mon, "Postcopy Blocktime (ms): %" PRIu32 "\n",
> > +                       info->postcopy_blocktime);
> > +    }
> > +
> > +    if (info->has_postcopy_vcpu_blocktime) {
> > +        uint32List *item = info->postcopy_vcpu_blocktime;
> > +        const char *sep = "";
> > +        int count = 0;
> > +
> > +        monitor_printf(mon, "Postcopy vCPU Blocktime (ms): \n [");
> > +
> > +        while (item) {
> > +            monitor_printf(mon, "%s%"PRIu32, sep, item->value);
> > +            item = item->next;
> > +            /* Each line 10 vcpu results, newline if there's more */
> > +            sep = ((++count % 10 == 0) && item) ? ",\n  " : ", ";
> > +        }
> > +        monitor_printf(mon, "]\n");
> > +    }
> > +
> > +    if (info->has_postcopy_latency) {
> > +        monitor_printf(mon, "Postcopy Latency (us): %" PRIu64 "\n",
> > +                       info->postcopy_latency);
> > +    }
> > +
> > +    if (info->has_postcopy_vcpu_latency) {
> > +        uint64List *item = info->postcopy_vcpu_latency;
> > +        int count = 0;
> > +
> > +        monitor_printf(mon, "Postcopy vCPU Latencies (us): \n [");
> > +
> > +        while (item) {
> > +            monitor_printf(mon, "%"PRIu64", ", item->value);
> > +            item = item->next;
> > +            /* Each line 10 vcpu results, newline if there's more */
> > +            if ((++count % 10 == 0) && item) {
> > +                monitor_printf(mon, "\n  ");
> > +            }
> > +        }
> > +        monitor_printf(mon, "\b\b]\n");
> 
> In the review of the other series I posted, Markus pointed out we should
> avoid using "\b" and suggested a better way.  I fixed it there, but I
> overlooked I have this similar use case in this series.  I'll fix this too
> when posting v3 with similar approach.

Just in case I won't need to repost again to pollute everyone's inbox..
this chunk now look like this:

+    if (info->has_postcopy_vcpu_latency) {
+        uint64List *item = info->postcopy_vcpu_latency;
+        const char *sep = "";
+        int count = 0;
+
+        monitor_printf(mon, "Postcopy vCPU Latencies (us): \n [");
+
+        while (item) {
+            monitor_printf(mon, "%s%"PRIu64, sep, item->value);
+            item = item->next;
+            /* Each line 10 vcpu results, newline if there's more */
+            sep = ((++count % 10 == 0) && item) ? ",\n  " : ", ";
+        }
+        monitor_printf(mon, "]\n");
+    }

I'm making bold to keep the R-b for Fabiano as of now unless there's
objection..

-- 
Peter Xu


Reply via email to