25     private $_leakCap = 0;
    37         $this->_memCap = $memCap ? 
$helper->convertToBytes($memCap) : 0;
    38         $this->_leakCap = $leakCap ? 
$helper->convertToBytes($leakCap) : 0;
    49         return PHP_EOL . 
'=== Memory Usage System Stats ===' . PHP_EOL;
    59         list($usage, $leak) = $this->_getUsage();
    63             "Memory usage (OS):\t%s (%.2F%% of %s reported by PHP",
    65             100 * $usage / ($usage - $leak),
    66             $this->_toMb($usage - $leak)
    68         $percentMsg = 
'%.2F%% of configured %s limit';
    70             $msg .= 
', ' . sprintf($percentMsg, 100 * $usage / $this->_memCap, $this->_toMb($this->_memCap));
    74         $msg = sprintf(
"Estimated memory leak:\t%s (%.2F%% of used memory", $this->_toMb($leak), 100 * $leak / $usage);
    75         if ($this->_leakCap) {
    76             $msg .= 
', ' . sprintf($percentMsg, 100 * $leak / $this->_leakCap, $this->_toMb($this->_leakCap));
    80         return implode(PHP_EOL, 
$result) . PHP_EOL;
    89     private function _toMb($bytes)
    91         return sprintf(
'%.2FM', $bytes / (1024 * 1024));
   102         if (!$this->_memCap && !$this->_leakCap) {
   105         list($usage, $leak) = $this->_getUsage();
   106         if ($this->_memCap && $usage >= $this->_memCap) {
   107             throw new \LogicException(
   108                 "Memory limit of {$this->_toMb($this->_memCap)} ({$this->_memCap} bytes) has been reached."   111         if ($this->_leakCap && $leak >= $this->_leakCap) {
   112             throw new \LogicException(
   113                 "Estimated memory leak limit of {$this->_toMb(   115                 )}" . 
" ({$this->_leakCap} bytes) has been reached."   125     private function _getUsage()
   127         $usage = $this->_helper->getRealMemoryUsage();
 
__construct($memCap, $leakCap, \Magento\TestFramework\Helper\Memory $helper)