mirror of
https://hk.gh-proxy.com/https://github.com/wp-cli/profile-command.git
synced 2025-08-21 06:39:02 +08:00
Merge pull request #12 from runcommand/drop-memory-usage
Drop memory usage from the profiler
This commit is contained in:
commit
0e1431274f
1 changed files with 0 additions and 12 deletions
|
@ -62,7 +62,6 @@ class Profile_Command {
|
|||
'query_time',
|
||||
'hook_count',
|
||||
'hook_time',
|
||||
'memory_usage',
|
||||
);
|
||||
foreach( array( 'total', 'bootstrap', 'main_query', 'template' ) as $scope ) {
|
||||
$this->scope_log[ $scope ] = array();
|
||||
|
@ -166,7 +165,6 @@ class Profile_Command {
|
|||
*/
|
||||
private function scope_track_end( $scope ) {
|
||||
global $wpdb;
|
||||
$this->scope_log[ $scope ]['memory_usage'] = self::convert_size( memory_get_usage( true ) );
|
||||
$this->scope_log[ $scope ]['execution_time'] = microtime( true ) - $this->scope_log[ $scope ]['execution_time'];
|
||||
$query_offset = 'total' === $scope ? 0 : $this->query_offset;
|
||||
for ( $i = $query_offset; $i < count( $wpdb->queries ); $i++ ) {
|
||||
|
@ -178,14 +176,4 @@ class Profile_Command {
|
|||
$this->scope_log[ $scope ]['hook_time'] = $hook_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a memory size to something human-readable
|
||||
*
|
||||
* @see http://php.net/manual/en/function.memory-get-usage.php#96280
|
||||
*/
|
||||
private static function convert_size( $size ) {
|
||||
$unit = array( 'b', 'kb', 'mb', 'gb', 'tb', 'pb' );
|
||||
return @round( $size / pow( 1024, ( $i= floor( log( $size,1024 ) ) ) ), 2 ) . $unit[ $i ];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue