/**
  * Formats a number with a level of precision.
  *
  * @param float $number A floating point number.
  * @param int $precision The precision of the returned number.
  * @return float Formatted float.
  * @see \Cake\I18n\Number::precision()
  * @link http://book.cakephp.org/3.0/en/views/helpers/number.html#formatting-floating-point-numbers
  */
 public function precision($number, $precision = 3)
 {
     return $this->_engine->precision($number, $precision);
 }
Beispiel #2
0
 /**
  * Get the summary for the panel.
  *
  * @return string
  */
 public function summary()
 {
     $time = Number::precision(DebugTimer::requestTime(), 2) . ' s';
     $memory = Number::toReadableSize(DebugMemory::getPeak());
     return "{$time} / {$memory}";
 }
Beispiel #3
0
 /**
  * Display some statistics about Finished Jobs.
  *
  * @return void
  */
 public function stats()
 {
     $this->out('Jobs currenty in the Queue:');
     $types = $this->QueuedTasks->getTypes()->toArray();
     foreach ($types as $type) {
         $this->out("      " . str_pad($type, 20, ' ', STR_PAD_RIGHT) . ": " . $this->QueuedTasks->getLength($type));
     }
     $this->hr();
     $this->out('Total unfinished Jobs      : ' . $this->QueuedTasks->getLength());
     $this->hr();
     $this->out('Finished Job Statistics:');
     $data = $this->QueuedTasks->getStats();
     foreach ($data as $item) {
         $this->out(" " . $item['jobtype'] . ": ");
         $this->out("   Finished Jobs in Database: " . $item['num']);
         $this->out("   Average Job existence    : " . str_pad(Number::precision($item['alltime']), 8, ' ', STR_PAD_LEFT) . 's');
         $this->out("   Average Execution delay  : " . str_pad(Number::precision($item['fetchdelay']), 8, ' ', STR_PAD_LEFT) . 's');
         $this->out("   Average Execution time   : " . str_pad(Number::precision($item['runtime']), 8, ' ', STR_PAD_LEFT) . 's');
     }
 }
 protected function _getDuration()
 {
     $seconds = $this->_properties['time_out']->toUnixString() - $this->_properties['time_in']->toUnixString();
     return Number::precision($seconds / HOUR, 2);
 }