ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
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
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
33
for
(
$i
= 0;
$i
<
$repeat
;
$i
++) {
34
35
$fb =
new
Sabre\VObject\FreeBusyGenerator
(
$start
,
$end
,
$vcal
,
$timeZone
);
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"
;
$argv
global $argv
Definition:
svg-scanner.php:41
formatMemory
formatMemory($input)
Definition:
bench_freebusygenerator.php:45
$input
$input
Definition:
bench_manipulatevcard.php:18
$splitter
$splitter
Definition:
bench_manipulatevcard.php:20
$vcal
$vcal
Definition:
bench_freebusygenerator.php:22
Sabre\VObject\FreeBusyGenerator
This class helps with generating FREEBUSY reports based on existing sets of objects.
Definition:
FreeBusyGenerator.php:26
Sabre\VObject\Version\VERSION
const VERSION
Full version number.
Definition:
Version.php:17
$bench
$bench
Definition:
bench_freebusygenerator.php:19
$end
$end
Definition:
bench_freebusygenerator.php:28
fopen
$timeZone
$timeZone
Definition:
bench_freebusygenerator.php:29
echo
Sabre\VObject\Reader\read
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition:
Reader.php:42
$start
$start
Definition:
bench_freebusygenerator.php:27
$results
$results
Definition:
svg-scanner.php:47
$i
$i
Definition:
disco.tpl.php:19
php
$repeat
$repeat
Definition:
bench_freebusygenerator.php:26
libs
composer
vendor
sabre
vobject
bin
bench_freebusygenerator.php
Generated on Thu Feb 27 2025 19:01:30 for ILIAS by
1.8.13 (using
Doxyfile
)