Message ID | 20200927090820.61859-3-f4bug@amsat.org |
---|---|
State | Superseded |
Headers | show |
Series | qdev-clock: Minor improvements to the Clock API | expand |
On 11:08 Sun 27 Sep , Philippe Mathieu-Daudé wrote: > Since commit 9f2ff99c7f2 ("qdev-monitor: print the device's clock > with info qtree") we can display the clock frequencies in the > monitor. Use the recently introduced freq_to_str() to display > the frequencies using the closest SI unit (human friendlier). > > Before: > > (qemu) info qtree > [...] > dev: xilinx,zynq_slcr, id "" > clock-in "ps_clk" freq_hz=3.333333e+07 > mmio 00000000f8000000/0000000000001000 > > After: > > dev: xilinx,zynq_slcr, id "" > clock-in "ps_clk" freq_hz=33.3 MHz > mmio 00000000f8000000/0000000000001000 > > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Luc Michel <luc@lmichel.fr> > --- > qdev-monitor.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/qdev-monitor.c b/qdev-monitor.c > index e9b7228480d..a0301cfca81 100644 > --- a/qdev-monitor.c > +++ b/qdev-monitor.c > @@ -747,11 +747,13 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent) > } > } > QLIST_FOREACH(ncl, &dev->clocks, node) { > - qdev_printf("clock-%s%s \"%s\" freq_hz=%e\n", > + g_autofree char *freq = NULL; > + > + freq = freq_to_str(clock_get_hz(ncl->clock)); > + qdev_printf("clock-%s%s \"%s\" freq_hz=%s\n", > ncl->output ? "out" : "in", > ncl->alias ? " (alias)" : "", > - ncl->name, > - CLOCK_PERIOD_TO_HZ(1.0 * clock_get(ncl->clock))); > + ncl->name, freq); > } > class = object_get_class(OBJECT(dev)); > do { > -- > 2.26.2 >
On 9/28/20 9:52 AM, Luc Michel wrote: > On 11:08 Sun 27 Sep , Philippe Mathieu-Daudé wrote: >> Since commit 9f2ff99c7f2 ("qdev-monitor: print the device's clock >> with info qtree") we can display the clock frequencies in the >> monitor. Use the recently introduced freq_to_str() to display >> the frequencies using the closest SI unit (human friendlier). >> >> Before: >> >> (qemu) info qtree >> [...] >> dev: xilinx,zynq_slcr, id "" >> clock-in "ps_clk" freq_hz=3.333333e+07 >> mmio 00000000f8000000/0000000000001000 >> >> After: >> >> dev: xilinx,zynq_slcr, id "" >> clock-in "ps_clk" freq_hz=33.3 MHz >> mmio 00000000f8000000/0000000000001000 >> >> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > > Reviewed-by: Luc Michel <luc@lmichel.fr> Reviewed-by: Damien Hedde <damien.hedde@greensocs.com> > >> --- >> qdev-monitor.c | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/qdev-monitor.c b/qdev-monitor.c >> index e9b7228480d..a0301cfca81 100644 >> --- a/qdev-monitor.c >> +++ b/qdev-monitor.c >> @@ -747,11 +747,13 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent) >> } >> } >> QLIST_FOREACH(ncl, &dev->clocks, node) { >> - qdev_printf("clock-%s%s \"%s\" freq_hz=%e\n", >> + g_autofree char *freq = NULL; >> + >> + freq = freq_to_str(clock_get_hz(ncl->clock)); >> + qdev_printf("clock-%s%s \"%s\" freq_hz=%s\n", >> ncl->output ? "out" : "in", >> ncl->alias ? " (alias)" : "", >> - ncl->name, >> - CLOCK_PERIOD_TO_HZ(1.0 * clock_get(ncl->clock))); >> + ncl->name, freq); >> } >> class = object_get_class(OBJECT(dev)); >> do { >> -- >> 2.26.2 >>
diff --git a/qdev-monitor.c b/qdev-monitor.c index e9b7228480d..a0301cfca81 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -747,11 +747,13 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent) } } QLIST_FOREACH(ncl, &dev->clocks, node) { - qdev_printf("clock-%s%s \"%s\" freq_hz=%e\n", + g_autofree char *freq = NULL; + + freq = freq_to_str(clock_get_hz(ncl->clock)); + qdev_printf("clock-%s%s \"%s\" freq_hz=%s\n", ncl->output ? "out" : "in", ncl->alias ? " (alias)" : "", - ncl->name, - CLOCK_PERIOD_TO_HZ(1.0 * clock_get(ncl->clock))); + ncl->name, freq); } class = object_get_class(OBJECT(dev)); do {
Since commit 9f2ff99c7f2 ("qdev-monitor: print the device's clock with info qtree") we can display the clock frequencies in the monitor. Use the recently introduced freq_to_str() to display the frequencies using the closest SI unit (human friendlier). Before: (qemu) info qtree [...] dev: xilinx,zynq_slcr, id "" clock-in "ps_clk" freq_hz=3.333333e+07 mmio 00000000f8000000/0000000000001000 After: dev: xilinx,zynq_slcr, id "" clock-in "ps_clk" freq_hz=33.3 MHz mmio 00000000f8000000/0000000000001000 Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- qdev-monitor.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)