From: Alistair Francis <alistair23@gmail.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Edgar E . Iglesias" <edgar.iglesias@xilinx.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Luc Michel" <luc@lmichel.fr>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
"Havard Skinnemoen" <hskinnemoen@google.com>,
"Tyrone Ting" <kfting@nuvoton.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Damien Hedde" <damien.hedde@greensocs.com>
Subject: Re: [PATCH v2 2/3] qdev-monitor: Display frequencies scaled to SI unit
Date: Thu, 1 Oct 2020 09:56:51 -0700 [thread overview]
Message-ID: <CAKmqyKNO_EPn_2CeKaqzTMCyAf7YhYA046GqZ6y2t0=Kcy06qA@mail.gmail.com> (raw)
In-Reply-To: <20201001164322.1585392-3-f4bug@amsat.org>
On Thu, Oct 1, 2020 at 9:43 AM Philippe Mathieu-Daudé <f4bug@amsat.org> 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
>
> Reviewed-by: Luc Michel <luc@lmichel.fr>
> Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> qdev-monitor.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/qdev-monitor.c b/qdev-monitor.c
> index e9b7228480..a0301cfca8 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
>
>
next prev parent reply other threads:[~2020-10-01 17:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 16:43 [PATCH v2 0/3] qdev-clock: Minor improvements to the Clock API Philippe Mathieu-Daudé
2020-10-01 16:43 ` [PATCH v2 1/3] util/cutils: Introduce freq_to_str() to display Hertz units Philippe Mathieu-Daudé
2020-10-01 16:55 ` Alistair Francis
2020-10-01 18:42 ` Eduardo Habkost
2020-10-10 16:31 ` Philippe Mathieu-Daudé
2020-10-02 7:09 ` Luc Michel
2020-10-01 16:43 ` [PATCH v2 2/3] qdev-monitor: Display frequencies scaled to SI unit Philippe Mathieu-Daudé
2020-10-01 16:56 ` Alistair Francis [this message]
2020-10-01 16:43 ` [PATCH v2 3/3] hw/qdev-clock: Display error hint when clock is missing from device Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKmqyKNO_EPn_2CeKaqzTMCyAf7YhYA046GqZ6y2t0=Kcy06qA@mail.gmail.com' \
--to=alistair23@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=berrange@redhat.com \
--cc=damien.hedde@greensocs.com \
--cc=edgar.iglesias@xilinx.com \
--cc=ehabkost@redhat.com \
--cc=f4bug@amsat.org \
--cc=hskinnemoen@google.com \
--cc=kfting@nuvoton.com \
--cc=luc@lmichel.fr \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).