Skip to content

Commit

Permalink
Added report of memory usage to CLI demo
Browse files Browse the repository at this point in the history
  • Loading branch information
A1essandro committed Jan 13, 2016
1 parent 4cfce3e commit cd808da
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions demo/cli.php
Expand Up @@ -4,9 +4,12 @@
require_once __DIR__ . '/../src/PerlinNoiseGenerator.php';
$gen = new MapGenerator\PerlinNoiseGenerator();

$memStart = memory_get_usage();
$gen->setPersistence(0.5);
$gen->setSize(750);
$gen->setSize(1025);
$gen->setMapSeed('seed');
$gen->generate();

echo sprintf('Time: %s', round(microtime(true) - $start, 3));
echo sprintf('Memory Peak Usage: %sMB', round(memory_get_peak_usage() / 1024 / 1024, 2)) . PHP_EOL;
echo sprintf('Memory Usage: %sMB', round((memory_get_usage() - $memStart) / 1024 / 1024, 2)) . PHP_EOL;
echo sprintf('Time: %s', round(microtime(true) - $start, 3)) . PHP_EOL;

0 comments on commit cd808da

Please sign in to comment.