1. Go to this page and download the library: Download hhpack/performance library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hhpack / performance example snippets
hack
use HHPack\Performance\PerformanceWatcher;
use HHPack\Performance\TimeWatcher;
use HHPack\Performance\MemoryWatcher;
use HHPack\Performance\Result\WatchedResult;
$watcher = PerformanceWatcher::fromItems([
Pair { 'time', new TimeWatcher() },
Pair { 'memory', new MemoryWatcher() }
]);
$watcher->start();
$watcher->stop();
$texts = $watcher->result()->mapWithKey(($key, $result) ==> {
return sprintf("%s: %s", $key, (string) $result->value());
})->values();
foreach ($texts as $text) {
echo $text, PHP_EOL;
}
hack
use HHPack\Performance as bench;
function sync_benchmarker() : void
{
bench\sync()->times(10)->run(() ==> {
usleep(2000);
});
}
sync_benchmarker();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.