[DTrace-devel] [PATCH 3/3] test: Mimic dtrace arithmetic more closely for avg/stddev
eugene.loh at oracle.com
eugene.loh at oracle.com
Thu May 1 18:22:52 UTC 2025
From: Eugene Loh <eugene.loh at oracle.com>
The multicpus test checks that data from multiple CPUs is aggregated
properly. Operations like avg() and stddev() require division.
DTrace uses integer division, while awk does not.
Change the awk check to truncate intermediate results after division.
In practice, intermediate results are typically integer values anyhow.
So the test has generally passed. Non-integer values could arise if,
for example, CPUs are not numbered consecutively. More typically,
there may be a problem that the profile probe is not firing on every
expected CPU. So a test failure probably was a sign of a problem,
but that's a different problem, one beyond the scope of this test.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
test/unittest/aggs/tst.multicpus.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/unittest/aggs/tst.multicpus.sh b/test/unittest/aggs/tst.multicpus.sh
index 50eeaae44..46c668867 100755
--- a/test/unittest/aggs/tst.multicpus.sh
+++ b/test/unittest/aggs/tst.multicpus.sh
@@ -79,10 +79,10 @@ gawk '
# first we finish computing our estimates for avg and stddev
# (the other results require no further action)
- xavg /= xcnt;
+ xavg /= xcnt; xavg = int(xavg);
- xstm /= xcnt;
- xstd /= xcnt;
+ xstm /= xcnt; xstm = int(xstm);
+ xstd /= xcnt; xstd = int(xstd);
xstd -= xstm * xstm;
xstd = int(sqrt(xstd));
--
2.43.5
More information about the DTrace-devel
mailing list