<?php
$ru = getrusage();
var_export(is_array($ru));
echo "\n";
var_export(isset($ru['ru_utime.tv_sec'], $ru['ru_maxrss']));
echo "\n";
$ru1 = getrusage(1); // RUSAGE_CHILDREN — may be false on some platforms
var_export($ru1 === false || is_array($ru1));
Category
php-in-php·stdlibProblem
getrusage()VM reads process stats viaext/standard/VmGetrusageNative.php(libcgetrusage(2)FFI) withVmGetrusagePure.phpfallback, but JIT reimplements Linuxstruct rusagelayout inlib/JIT/Builtin/StringGetrusage.php(__compiler_getrusage, hard-coded x86_64 offsets). Layout duplication is fragile and blocks PHP-in-PHP (#1492).php-src reference
ext/standard/basic_functions.c—PHP_FUNCTION(getrusage)ext/standard/microtime.c— resource usage helpersRepro
Scope
ext/standard/getrusage.php,VmGetrusageNative.php,VmGetrusagePure.phpext/standard/JitGetrusageArg.php+ route to PHP helperlib/JIT/Builtin/StringGetrusage.phpoffset tabletest/compliance/cases/stdlib/getrusage_jit_vm.phptDone when (php-src-strict)
__compiler_getrusageLLVM implementation removed./script/ci-fast.sh --filter getrusage_jitgreenRelated