getMemPeak() public static méthode

统计区间的内存峰值情况
public static getMemPeak ( string $start, string $end, integer | string $dec = 2 ) : mixed
$start string 开始标签
$end string 结束标签
$dec integer | string 小数位
Résultat mixed
Exemple #1
0
 /**
  * @covers think\Debug::getMemPeak
  * @todo Implement testGetMemPeak().
  */
 public function testGetMemPeak()
 {
     $start = "testGetMemPeakStart";
     $end = "testGetMemPeakEnd";
     \think\Debug::remark($start);
     $str = "";
     for ($i = 0; $i < 100000; $i++) {
         $str .= "mem";
     }
     $memPeak = \think\Debug::getMemPeak($start, $end);
     // echo "\r\n" . $memPeak . "\r\n";
     $this->assertLessThan(238, explode(" ", $memPeak)[0]);
 }
Exemple #2
0
 /**
  * @covers think\Debug::getMemPeak
  * @todo Implement testGetMemPeak().
  */
 public function testGetMemPeak()
 {
     $start = "testGetMemPeakStart";
     $end = "testGetMemPeakEnd";
     Debug::remark($start);
     $str = "";
     for ($i = 0; $i < 100000; $i++) {
         $str .= "mem";
     }
     $memPeak = Debug::getMemPeak($start, $end);
     $this->assertLessThan(400, explode(" ", $memPeak)[0]);
 }