BiliHelper-personal/src/tool/DumpMemory.php
2022-04-05 14:41:33 +08:00

26 lines
561 B
PHP

<?php
/**
* Website: https://mudew.com/
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
* Updated: 2022 ~ 2023
* Source: https://github.com/anhao/bv2av/
*/
namespace BiliHelper\Tool;
use BiliHelper\Core\Log;
class DumpMemory
{
public static function dd($title)
{
$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
$size = memory_get_usage(true);
$memory = @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i];
Log::warning("$title # 内存 # $memory");
}
}