diff options
author | redmatrix <git@macgirvin.com> | 2016-05-10 17:26:44 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-05-10 17:26:44 -0700 |
commit | 0b02a6d123b2014705998c94ddf3d460948d3eac (patch) | |
tree | 78ff2cab9944a4f5ab3f80ec93cbe1120de90bb2 /vendor/sabre/vobject/bin/bench_freebusygenerator.php | |
parent | 40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb (diff) | |
download | volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.gz volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.bz2 volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.zip |
initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import)
Diffstat (limited to 'vendor/sabre/vobject/bin/bench_freebusygenerator.php')
-rw-r--r-- | vendor/sabre/vobject/bin/bench_freebusygenerator.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/vendor/sabre/vobject/bin/bench_freebusygenerator.php b/vendor/sabre/vobject/bin/bench_freebusygenerator.php new file mode 100644 index 000000000..2c51b2a32 --- /dev/null +++ b/vendor/sabre/vobject/bin/bench_freebusygenerator.php @@ -0,0 +1,62 @@ +<?php + +include __DIR__ . '/../vendor/autoload.php'; + +if ($argc < 2) { + echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " freebusy benchmark\n"; + echo "\n"; + echo "This script can be used to measure the speed of generating a\n"; + echo "free-busy report based on a calendar.\n"; + echo "\n"; + echo "The process will be repeated 100 times to get accurate stats\n"; + echo "\n"; + echo "Usage: " . $argv[0] . " inputfile.ics\n"; + die(); +} + +list(, $inputFile) = $argv; + +$bench = new Hoa\Bench\Bench(); +$bench->parse->start(); + +$vcal = Sabre\VObject\Reader::read(fopen($inputFile, 'r')); + +$bench->parse->stop(); + +$repeat = 100; +$start = new \DateTime('2000-01-01'); +$end = new \DateTime('2020-01-01'); +$timeZone = new \DateTimeZone('America/Toronto'); + +$bench->fb->start(); + +for ($i = 0; $i < $repeat; $i++) { + + $fb = new Sabre\VObject\FreeBusyGenerator($start, $end, $vcal, $timeZone); + $results = $fb->getResult(); + +} +$bench->fb->stop(); + + + +echo $bench,"\n"; + +function formatMemory($input) { + + if (strlen($input) > 6) { + + return round($input / (1024 * 1024)) . 'M'; + + } elseif (strlen($input) > 3) { + + return round($input / 1024) . 'K'; + + } + +} + +unset($input, $splitter); + +echo "peak memory usage: " . formatMemory(memory_get_peak_usage()), "\n"; +echo "current memory usage: " . formatMemory(memory_get_usage()), "\n"; |