start() public static method

Starts measuring. Returns timer name.
public static start ( string $name = '' ) : string
$name string Custom timer name
return string
Beispiel #1
0
 /**
  * Starts profiling.
  *
  * @return \Jyxo\Rpc\Client
  */
 protected function profileStart()
 {
     // Set start time
     if ($this->profiler) {
         $this->timer = \Jyxo\Timer::start();
     }
     return $this;
 }
Beispiel #2
0
 /**
  * Runs a single test.
  *
  * @param string $ident Test identifier
  * @return array
  * @throws \UnexpectedValueException If the test returned an unknown result value
  */
 private function runTest(string $ident) : array
 {
     // Runs the test
     $timer = \Jyxo\Timer::start();
     $result = $this->tests[$ident]->run();
     if (!$result instanceof \Jyxo\Beholder\Result) {
         throw new \UnexpectedValueException(sprintf('Result %s of the test %s is not a %s instance.', $result, $ident, \Jyxo\Beholder\Result::class));
     }
     // Returns result data
     return ['ident' => $ident, 'test' => $this->tests[$ident], 'result' => $result, 'duration' => \Jyxo\Timer::stop($timer)];
 }