Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
21 */ | 21 */ |
22 class MemoryDataCollector extends DataCollector implements LateDataCollectorInterface | 22 class MemoryDataCollector extends DataCollector implements LateDataCollectorInterface |
23 { | 23 { |
24 public function __construct() | 24 public function __construct() |
25 { | 25 { |
26 $this->data = array( | 26 $this->reset(); |
27 'memory' => 0, | |
28 'memory_limit' => $this->convertToBytes(ini_get('memory_limit')), | |
29 ); | |
30 } | 27 } |
31 | 28 |
32 /** | 29 /** |
33 * {@inheritdoc} | 30 * {@inheritdoc} |
34 */ | 31 */ |
35 public function collect(Request $request, Response $response, \Exception $exception = null) | 32 public function collect(Request $request, Response $response, \Exception $exception = null) |
36 { | 33 { |
37 $this->updateMemoryUsage(); | 34 $this->updateMemoryUsage(); |
35 } | |
36 | |
37 /** | |
38 * {@inheritdoc} | |
39 */ | |
40 public function reset() | |
41 { | |
42 $this->data = array( | |
43 'memory' => 0, | |
44 'memory_limit' => $this->convertToBytes(ini_get('memory_limit')), | |
45 ); | |
38 } | 46 } |
39 | 47 |
40 /** | 48 /** |
41 * {@inheritdoc} | 49 * {@inheritdoc} |
42 */ | 50 */ |
97 $max = (int) $max; | 105 $max = (int) $max; |
98 } | 106 } |
99 | 107 |
100 switch (substr($memoryLimit, -1)) { | 108 switch (substr($memoryLimit, -1)) { |
101 case 't': $max *= 1024; | 109 case 't': $max *= 1024; |
110 // no break | |
102 case 'g': $max *= 1024; | 111 case 'g': $max *= 1024; |
112 // no break | |
103 case 'm': $max *= 1024; | 113 case 'm': $max *= 1024; |
114 // no break | |
104 case 'k': $max *= 1024; | 115 case 'k': $max *= 1024; |
105 } | 116 } |
106 | 117 |
107 return $max; | 118 return $max; |
108 } | 119 } |