aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-07-09 16:14:59 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-07-15 19:34:33 +0200
commitb2ed4df79e82a6c95feadbe6efefced7bbeb4db2 (patch)
tree57aeb7b31c3f9abbf845a3d04f2b185513e95c0b
parentd6c73ac306a8fca6d98f91e447904c5149d56ed8 (diff)
downloadqemu-b2ed4df79e82a6c95feadbe6efefced7bbeb4db2.zip
qemu-b2ed4df79e82a6c95feadbe6efefced7bbeb4db2.tar.gz
qemu-b2ed4df79e82a6c95feadbe6efefced7bbeb4db2.tar.bz2
accel/tcg: Do not dump NaN statistics
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>
-rw-r--r--accel/tcg/monitor.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
index e7ed728..778b126 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);
}