Arquivos
hhvm/hphp/test/vm/Setprofile.php
T
mwilliams 52697c84a0 Fix profiling of continuations
In the interpreter, neither ContEnter nor ContExit checked the
surprise flags, resulting in the time being attributed to the
callers. In the jit, ContEnter checked the surprise flags, but
ContExit did not, resulting in what appeared to be highly
recursive profiles.
2013-02-11 03:44:05 -08:00

46 linhas
787 B
PHP

<?php
function pure_function($a) {
return 7;
}
function pure_function_2($a, $b) {
return pure_function($a) + pure_function($b);
}
function pure_function_no_profile() {
return null;
}
function test_exception() {
throw new Exception('test');
}
function profiler() {
// Calling functions from within the profiler function should note
// use the profile (it would cause an infinite loop)
pure_function_no_profile();
var_dump(func_get_args());
}
function gen() {
yield 1;
yield 2;
}
function main() {
pure_function_2(1, 2);
fb_setprofile('profiler');
pure_function_2(3, 4);
srand(0xdeadbeef);
try {
test_exception();
} catch (Exception $e) {
//do nothing.
}
foreach (gen() as $x) {}
fb_setprofile(null);
pure_function_2(5, 6);
}
main();