1 : <?php
2 :
3 : /**
4 : * XSLT Benchmarking
5 : * @link https://github.com/masicek/XSLT-Benchmarking
6 : * @author Viktor Mašíček <viktor@masicek.net>
7 : * @license "New" BSD License
8 : */
9 :
10 : namespace XSLTBenchmarking\TestsRunner;
11 :
12 : require_once ROOT . '/DriversContainer.php';
13 :
14 : /**
15 : * Class for geting memory usage of command excuteb by 'exec'
16 : *
17 : * @author Viktor Mašíček <viktor@masicek.net>
18 : */
19 : class MemoryUsage extends \XSLTBenchmarking\DriversContainer
20 : {
21 :
22 : /**
23 : * Value of PHP_OS for Windows
24 : */
25 : const OS_WIN = 'WINNT';
26 :
27 : /**
28 : * Value of PHP_OS for Linux
29 : */
30 : const OS_LINUX = 'Linux';
31 :
32 :
33 : /**
34 : * List of possible drivers
35 : *
36 : * @var array
37 : */
38 : private $driversNames = array(
39 : self::OS_WIN => 'Windows',
40 : self::OS_LINUX => 'Linux',
41 : );
42 :
43 :
44 : /**
45 : * Prepare checking memory usage of set command.
46 : * Drivers can return modified commad for better checking.
47 : *
48 : * @param string $command Checked command
49 : *
50 : * @return string
51 : */
52 : public function run($command)
53 : {
54 0 : $this->setDriver($this->driversNames[PHP_OS]);
55 0 : return parent::run($command);
56 : }
57 :
58 :
59 : }
|