convert_hr_to_bytes() public static method

public static convert_hr_to_bytes ( $size )
Beispiel #1
0
 public function process()
 {
     $this->data['time_taken'] = self::timer_stop_float();
     $this->data['time_limit'] = ini_get('max_execution_time');
     $this->data['time_start'] = $GLOBALS['timestart'];
     if (!empty($this->data['time_limit'])) {
         $this->data['time_usage'] = 100 / $this->data['time_limit'] * $this->data['time_taken'];
     } else {
         $this->data['time_usage'] = 0;
     }
     if (function_exists('memory_get_peak_usage')) {
         $this->data['memory'] = memory_get_peak_usage();
     } else {
         if (function_exists('memory_get_usage')) {
             $this->data['memory'] = memory_get_usage();
         } else {
             $this->data['memory'] = 0;
         }
     }
     if (is_user_logged_in()) {
         $this->data['current_user'] = self::format_user(wp_get_current_user());
     } else {
         $this->data['current_user'] = false;
     }
     if (function_exists('current_user_switched') && current_user_switched()) {
         $this->data['switched_user'] = self::format_user(current_user_switched());
     } else {
         $this->data['switched_user'] = false;
     }
     $this->data['memory_limit'] = QM_Util::convert_hr_to_bytes(ini_get('memory_limit'));
     $this->data['memory_usage'] = 100 / $this->data['memory_limit'] * $this->data['memory'];
     $this->data['is_admin'] = is_admin();
 }
Beispiel #2
0
 public function process()
 {
     $this->data['time'] = self::timer_stop_float();
     $this->data['time_limit'] = ini_get('max_execution_time');
     if (!empty($this->data['time_limit'])) {
         $this->data['time_usage'] = 100 / $this->data['time_limit'] * $this->data['time'];
     } else {
         $this->data['time_usage'] = 0;
     }
     $this->data['memory'] = memory_get_peak_usage();
     $this->data['memory_limit'] = QM_Util::convert_hr_to_bytes(ini_get('memory_limit'));
     $this->data['memory_usage'] = 100 / $this->data['memory_limit'] * $this->data['memory'];
 }