PHP
benchmark

PHPの簡単ベンチマーク

More than 3 years have passed since last update.

使用メモリや実行時間、読み込みファイル等の情報をスクリプト終了時に表示します。

$time = microtime(true);

register_shutdown_function(
function() use ($time) {
printf("Memory: %s / %s bytes\nTime: %f ms\nDeclared: %d classes\nIncluded: %d files > include_files.txt\n",
number_format(memory_get_usage()),
number_format(memory_get_peak_usage()),
(microtime(true) - $time) * 1000,
count(get_declared_classes()),
count(get_included_files())
);
file_put_contents(__DIR__ . '/include_files.txt', print_r(get_included_files(), true));

}
);