ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
bench_freebusygenerator.php
Go to the documentation of this file.
1<?php
2
3include __DIR__ . '/../vendor/autoload.php';
4
5if ($argc < 2) {
6 echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " freebusy benchmark\n";
7 echo "\n";
8 echo "This script can be used to measure the speed of generating a\n";
9 echo "free-busy report based on a calendar.\n";
10 echo "\n";
11 echo "The process will be repeated 100 times to get accurate stats\n";
12 echo "\n";
13 echo "Usage: " . $argv[0] . " inputfile.ics\n";
14 die();
15}
16
17list(, $inputFile) = $argv;
18
19$bench = new Hoa\Bench\Bench();
20$bench->parse->start();
21
22$vcal = Sabre\VObject\Reader::read(fopen($inputFile, 'r'));
23
24$bench->parse->stop();
25
26$repeat = 100;
27$start = new \DateTime('2000-01-01');
28$end = new \DateTime('2020-01-01');
29$timeZone = new \DateTimeZone('America/Toronto');
30
31$bench->fb->start();
32
33for ($i = 0; $i < $repeat; $i++) {
34
36 $results = $fb->getResult();
37
38}
39$bench->fb->stop();
40
41
42
43echo $bench,"\n";
44
46
47 if (strlen($input) > 6) {
48
49 return round($input / (1024 * 1024)) . 'M';
50
51 } elseif (strlen($input) > 3) {
52
53 return round($input / 1024) . 'K';
54
55 }
56
57}
58
59unset($input, $splitter);
60
61echo "peak memory usage: " . formatMemory(memory_get_peak_usage()), "\n";
62echo "current memory usage: " . formatMemory(memory_get_usage()), "\n";
formatMemory($input)
An exception for terminatinating execution or to throw for unit testing.
This class helps with generating FREEBUSY reports based on existing sets of objects.
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
const VERSION
Full version number.
Definition: Version.php:17
$i
Definition: disco.tpl.php:19
$results
Definition: svg-scanner.php:47
global $argv
Definition: svg-scanner.php:41