Skip to content

Commit

Permalink
Fix max number of samples in experiments on non-64-bit systems.
Browse files Browse the repository at this point in the history
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 <nazhari@cloudbasesolutions.com>
  • Loading branch information
aznashwan committed Mar 25, 2022
1 parent c8ba582 commit c2b3449
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gmeasure/experiment.go
Expand Up @@ -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
}
Expand Down

0 comments on commit c2b3449

Please sign in to comment.