From c2b34497b6b8408ef8a86bb6f4c76272b0f816a1 Mon Sep 17 00:00:00 2001 From: Nashwan Azhari Date: Fri, 25 Mar 2022 16:45:07 +0200 Subject: [PATCH] Fix max number of samples in experiments on non-64-bit systems. The use of `math.MaxInt64` as the maximum number of samples in the context of general int variables can lead to inconsistent behavior on non-64-bit systems. This patch addresses this by using `math.MaxInt32` as the default sample size in case an explicit one is not provided in the `SamplingConfig`. Signed-off-by: Nashwan Azhari --- gmeasure/experiment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gmeasure/experiment.go b/gmeasure/experiment.go index 2ac521d73..1c2d30096 100644 --- a/gmeasure/experiment.go +++ b/gmeasure/experiment.go @@ -452,7 +452,7 @@ func (e *Experiment) Sample(callback func(idx int), samplingConfig SamplingConfi if samplingConfig.Duration > 0 { maxTime = time.Now().Add(samplingConfig.Duration) } - maxN := math.MaxInt64 + maxN := math.MaxInt32 if samplingConfig.N > 0 { maxN = samplingConfig.N }