-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.testsuite-without-accelerator.php
58 lines (45 loc) · 1.35 KB
/
run.testsuite-without-accelerator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
$dir = dirname(__FIlE__);
$files = glob('test*.php');
$include_overhead = 0;
$include_index = 0;
$mem = $mem2 = 0;
// Test include overhead
$include_index++;
include 'include.smalltest.php';
foreach($files as $testfile)
{
if(strpos($testfile, 'myclass') !== FALSE || strpos($testfile, 'zend') !== FALSE)
continue;
$include_index++;
include $testfile;
echo sprintf('%2d %-40s %7d', $include_index, preg_replace('/test\.(.*)\.php/', '$1', $testfile), $mem).PHP_EOL;
}
$files = glob('test.myclass*.php');
$files = array_merge($files, glob('test.zend*.php'));
$char = 'aa';
$simple_testfilename = '';
$bits = '';
foreach($files as $testfile)
{
$bits = sprintf('%b', $include_index+1);
if(substr_count($bits , '1') == 1)
{
$simple_testfilename = '/tmp/_'.$char++;
touch($simple_testfilename);
include $simple_testfilename;
unlink($simple_testfilename);
$include_index++;
}
$simple_testfilename = '/tmp/_'.$char;
copy($testfile, $simple_testfilename);
$char++;
$include_index++;
$mem = memory_get_usage();
include $simple_testfilename;
$mem = memory_get_usage() - $mem - $include_overhead;
if(strpos($testfile, 'instance') !== FALSE)
$mem = $mem2;
unlink($simple_testfilename);
echo sprintf('%2d %-40s %7d', $include_index, preg_replace('/test\.(.*)\.php/', '$1', $testfile), $mem).PHP_EOL;
}