ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
bench_freebusygenerator.php
Go to the documentation of this file.
1 <?php
2 
3 include __DIR__ . '/../vendor/autoload.php';
4 
5 if ($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 
17 list(, $inputFile) = $argv;
18 
19 $bench = new Hoa\Bench\Bench();
20 $bench->parse->start();
21 
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 
33 for ($i = 0; $i < $repeat; $i++) {
34 
36  $results = $fb->getResult();
37 
38 }
39 $bench->fb->stop();
40 
41 
42 
43 echo $bench,"\n";
44 
45 function formatMemory($input) {
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 
59 unset($input, $splitter);
60 
61 echo "peak memory usage: " . formatMemory(memory_get_peak_usage()), "\n";
62 echo "current memory usage: " . formatMemory(memory_get_usage()), "\n";
global $argv
Definition: svg-scanner.php:41
formatMemory($input)
This class helps with generating FREEBUSY reports based on existing sets of objects.
const VERSION
Full version number.
Definition: Version.php:17
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
$results
Definition: svg-scanner.php:47
$i
Definition: disco.tpl.php:19