aboutsummaryrefslogtreecommitdiffstats
path: root/includes/profiler
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2024-09-23 14:52:56 -0700
committerKrinkle <krinkle@fastmail.com>2024-09-25 00:44:31 +0000
commit44db493ed17a633580cb75cb1b3fac3e333001d7 (patch)
treea959987c861ed75e012920ea1ed65eaf51276569 /includes/profiler
parentbc72d5b4f78cdd9f82e2bab61d3d65e28834cd97 (diff)
downloadmediawikicore-44db493ed17a633580cb75cb1b3fac3e333001d7.tar.gz
mediawikicore-44db493ed17a633580cb75cb1b3fac3e333001d7.zip
objectcache,profiler,externalstore: Simpler mt_rand() for 1 in N chance
Based on https://gerrit.wikimedia.org/r/1057269, as confirmed by https://3v4l.org/XW30U. Change-Id: I5dc2e140a213bf59f48e39c333280f9662979964
Diffstat (limited to 'includes/profiler')
-rw-r--r--includes/profiler/Profiler.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php
index d5b0ad5cba2b..d7608fb2242a 100644
--- a/includes/profiler/Profiler.php
+++ b/includes/profiler/Profiler.php
@@ -76,7 +76,7 @@ abstract class Profiler {
// Avoid global func wfIsCLI() during setup
$isCLI = ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' );
- $inSample = $params['sampling'] === 1 || mt_rand( 0, $params['sampling'] - 1 ) === 0;
+ $inSample = $params['sampling'] === 1 || mt_rand( 1, $params['sampling'] ) === 1;
if (
!$inSample ||
// On CLI, profiling is disabled by default, and can be explicitly enabled