Calculate memory and peak memory usage in profiler, too.
This commit is contained in:
parent
bcd63ab5af
commit
98b92185e3
|
@ -28,11 +28,25 @@ public static function render($response)
|
||||||
// type applications, so we will not send anything in those scenarios.
|
// type applications, so we will not send anything in those scenarios.
|
||||||
if ( ! Request::ajax())
|
if ( ! Request::ajax())
|
||||||
{
|
{
|
||||||
|
static::$data['memory'] = static::get_file_size(memory_get_usage(true));
|
||||||
|
static::$data['memory_peak'] = static::get_file_size(memory_get_peak_usage(true));
|
||||||
static::$data['time'] = number_format((microtime(true) - LARAVEL_START) * 1000, 2);
|
static::$data['time'] = number_format((microtime(true) - LARAVEL_START) * 1000, 2);
|
||||||
return render('path: '.__DIR__.'/template'.BLADE_EXT, static::$data);
|
return render('path: '.__DIR__.'/template'.BLADE_EXT, static::$data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the human-readable file size (with proper units).
|
||||||
|
*
|
||||||
|
* @param int $size
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function get_file_size($size)
|
||||||
|
{
|
||||||
|
$units = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB');
|
||||||
|
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$units[$i];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a log entry to the log entries array.
|
* Add a log entry to the log entries array.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue