aboutsummaryrefslogtreecommitdiff
path: root/softmmu
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-12-15 15:09:29 +0000
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2021-01-04 23:24:44 +0100
commitb7cd9c1e840d511319f326ee8cab772b3ac50a3b (patch)
tree3f188cddddb2034e0e268be2070151c4518e6b8b /softmmu
parentde6a65f11d7e5a2a93f2b75c0d434ab6ed7f68c8 (diff)
downloadqemu-b7cd9c1e840d511319f326ee8cab772b3ac50a3b.zip
qemu-b7cd9c1e840d511319f326ee8cab772b3ac50a3b.tar.gz
qemu-b7cd9c1e840d511319f326ee8cab772b3ac50a3b.tar.bz2
clock: Define and use new clock_display_freq()
It's common to want to print a human-readable indication of a clock's frequency. Provide a utility function in the clock API to return a string which is a displayable representation of the frequency, and use it in qdev-monitor.c. 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: Peter Maydell <peter.maydell@linaro.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Luc Michel <luc@lmichel.fr> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20201215150929.30311-5-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'softmmu')
-rw-r--r--softmmu/qdev-monitor.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 2c57e36..8dc656b 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -736,11 +736,11 @@ 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_str = clock_display_freq(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_str);
}
class = object_get_class(OBJECT(dev));
do {