qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 06/17] accel/tcg: Do not dump NaN statistics
Date: Tue, 15 Jul 2025 21:45:05 +0200	[thread overview]
Message-ID: <20250715194516.91722-7-philmd@linaro.org> (raw)
In-Reply-To: <20250715194516.91722-1-philmd@linaro.org>

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-Id: <20250710111303.8917-1-philmd@linaro.org>
---
 accel/tcg/monitor.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
index e7ed7281a4b..778b12613f4 100644
--- a/accel/tcg/monitor.c
+++ b/accel/tcg/monitor.c
@@ -19,7 +19,7 @@
 #include "tcg/tcg.h"
 #include "internal-common.h"
 #include "tb-context.h"
-
+#include <math.h>
 
 static void dump_drift_info(GString *buf)
 {
@@ -57,6 +57,7 @@ static void print_qht_statistics(struct qht_stats hst, GString *buf)
     uint32_t hgram_opts;
     size_t hgram_bins;
     char *hgram;
+    double avg;
 
     if (!hst.head_buckets) {
         return;
@@ -73,9 +74,13 @@ static void print_qht_statistics(struct qht_stats hst, GString *buf)
         hgram_opts |= QDIST_PR_NODECIMAL;
     }
     hgram = qdist_pr(&hst.occupancy, 10, hgram_opts);
-    g_string_append_printf(buf, "TB hash occupancy   %0.2f%% avg chain occ. "
-                           "Histogram: %s\n",
-                           qdist_avg(&hst.occupancy) * 100, hgram);
+    avg = qdist_avg(&hst.occupancy);
+    if (!isnan(avg)) {
+        g_string_append_printf(buf, "TB hash occupancy   "
+                                    "%0.2f%% avg chain occ. "
+                                    "Histogram: %s\n",
+                               avg * 100, hgram);
+    }
     g_free(hgram);
 
     hgram_opts = QDIST_PR_BORDER | QDIST_PR_LABELS;
@@ -87,9 +92,12 @@ static void print_qht_statistics(struct qht_stats hst, GString *buf)
         hgram_opts |= QDIST_PR_NODECIMAL | QDIST_PR_NOBINRANGE;
     }
     hgram = qdist_pr(&hst.chain, hgram_bins, hgram_opts);
-    g_string_append_printf(buf, "TB hash avg chain   %0.3f buckets. "
-                           "Histogram: %s\n",
-                           qdist_avg(&hst.chain), hgram);
+    avg = qdist_avg(&hst.chain);
+    if (!isnan(avg)) {
+        g_string_append_printf(buf, "TB hash avg chain   %0.3f buckets. "
+                                    "Histogram: %s\n",
+                               avg, hgram);
+    }
     g_free(hgram);
 }
 
-- 
2.49.0



  parent reply	other threads:[~2025-07-15 19:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 19:44 [PULL 00/17] Accelerators patches for 2025-07-15 Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 01/17] hw/xen/arch_hvm: Unify x86 and ARM variants Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 02/17] hw/arm/xen-pvh: Remove unnecessary 'hw/xen/arch_hvm.h' header Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 03/17] qapi/accel: Move definitions related to accelerators in their own file Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 04/17] qapi/machine: Add @qom-type field to CpuInfoFast structure Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 05/17] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
2025-07-15 19:45 ` Philippe Mathieu-Daudé [this message]
2025-07-15 19:45 ` [PULL 07/17] accel: Rename 'system/accel-ops.h' -> 'accel/accel-cpu-ops.h' Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 08/17] accel: Extract AccelClass definition to 'accel/accel-ops.h' Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 09/17] Revert "accel/tcg: Unregister the RCU before exiting RR thread" Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 10/17] accel/tcg: Extract statistic related code to tcg-stats.c Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 11/17] accel/system: Introduce @x-accel-stats QMP command Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 12/17] accel/system: Add 'info accel' on human monitor Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 13/17] accel/tcg: Propagate AccelState to dump_accel_info() Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 14/17] accel/tcg: Implement AccelClass::get_stats() handler Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 15/17] accel/hvf: Implement AccelClass::get_vcpu_stats() handler Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 16/17] system/runstate: Document qemu_add_vm_change_state_handler() Philippe Mathieu-Daudé
2025-07-15 19:45 ` [PULL 17/17] system/runstate: Document qemu_add_vm_change_state_handler_prio* in hdr Philippe Mathieu-Daudé
2025-07-16 12:41 ` [PULL 00/17] Accelerators patches for 2025-07-15 Stefan Hajnoczi

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=20250715194516.91722-7-philmd@linaro.org \
    --to=philmd@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).