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 LIBS . '/PhpPath/PhpPath.min.php';
13 :
14 : use PhpPath\P;
15 :
16 :
17 : /**
18 : * Different OS interface for class for geting maximum memory usage of command excuteb by 'exec'.
19 : *
20 : * @author Viktor Mašíček <viktor@masicek.net>
21 : */
22 : abstract class AMemoryUsageDriver
23 : {
24 :
25 :
26 : /**
27 : * Path of temporary directory
28 : *
29 : * @var string
30 : */
31 : protected $tmpDir;
32 :
33 :
34 : /**
35 : * Set temporary directory for possible using in drivers
36 : *
37 : * @param string $tmpDir Path of temporary directory
38 : */
39 : public function __construct($tmpDir)
40 : {
41 0 : $this->tmpDir = P::mcd($tmpDir);
42 0 : }
43 :
44 :
45 : /**
46 : * Prepare checking memory usage of set command.
47 : * Drivers can return modified commad for better checking.
48 : *
49 : * @param string $command Checked command
50 : *
51 : * @return string
52 : */
53 : abstract public function run($command);
54 :
55 :
56 : /**
57 : * Return maximum memory usage (in bytes) last checked command by self::run().
58 : *
59 : * @return integer
60 : */
61 : abstract public function get();
62 :
63 :
64 : }
|