当前位置: 首页>>代码示例>>PHP>>正文


PHP Stopwatch::start方法代码示例

本文整理汇总了PHP中Symfony\Component\Stopwatch\Stopwatch::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Stopwatch::start方法的具体用法?PHP Stopwatch::start怎么用?PHP Stopwatch::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Stopwatch\Stopwatch的用法示例。


在下文中一共展示了Stopwatch::start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rasterizeUrl

 /**
  * @param        $url
  * @param array  $arguments
  * @param string $uniqueId
  *
  * @throws \Exception
  *
  * @return string
  */
 public function rasterizeUrl($url, $arguments = array(), $uniqueId = "")
 {
     if ($uniqueId === "") {
         $uniqueId = uniqid("rasterize-");
     }
     if ($this->stopwatch instanceof Stopwatch) {
         if ($this->stopwatch->isStarted($uniqueId)) {
             $this->stopwatch->lap($uniqueId);
         } else {
             $this->stopwatch->start($uniqueId);
         }
     }
     $process = $this->configHelper->buildProcess($url, $uniqueId, $arguments);
     $exitCode = $process->run();
     if ($exitCode != 0) {
         throw new \Exception(sprintf("Rasterize script failed.\nCommandLine: %s\nExitCode: %d\nErrorOutput: %s", $process->getCommandLine(), $process->getExitCode(), $process->getErrorOutput()));
     }
     if ($this->stopwatch instanceof Stopwatch) {
         $this->stopwatch->stop($uniqueId);
     }
     $output = $this->configHelper->getOutputFilePath($uniqueId);
     $content = file_get_contents($output);
     unlink($output);
     return $content;
 }
开发者ID:baiolo,项目名称:RasterizeBundle,代码行数:34,代码来源:Rasterizer.php

示例2: startProfiling

 /**
  * @param CleverAge\Orchestrator\Events\ServiceEvent $event
  * @return Symfony\Component\Stopwatch\StopwatchEvent
  */
 protected function startProfiling(ServiceEvent $event)
 {
     if ($this->stopwatch instanceof Stopwatch) {
         $this->profiles[$event->getService()->getName()][$this->counter] = array('method' => $event->getRequestMethod(), 'parameters' => print_r($event->getRequestParameters(), true), 'results' => null, 'duration' => null, 'result_count' => 0);
         return $this->stopwatch->start($event->getService()->getName() . '_' . $this->counter);
     }
 }
开发者ID:cleverage,项目名称:php-orchestrator,代码行数:11,代码来源:DataCollectorListener.php

示例3: emit

 /**
  * @param $event
  * @param $parameters
  *
  * @return mixed|void
  */
 public function emit($event, $parameters)
 {
     self::$depth++;
     $this->stopwatch->openSection();
     if (isset($this->callbacks[$event])) {
         if (!$this->callbacks[$event][0]) {
             usort($this->callbacks[$event][1], function ($A, $B) {
                 if ($A[0] == $B[0]) {
                     return 0;
                 }
                 return $A[0] > $B[0] ? 1 : -1;
             });
             $this->callbacks[$event][0] = true;
         }
         foreach ($this->callbacks[$event][1] as $item) {
             $name = $this->getCallableName($item[1]);
             $this->stopwatch->start($name);
             $diagnoseEvent = Event::create()->setEvent($event)->setCallback($name)->setDepth(self::$depth);
             $this->events[] = $diagnoseEvent;
             call_user_func_array($item[1], $this->buildParameters($parameters));
             $stopwatchEvent = $this->stopwatch->stop($name);
             $diagnoseEvent->setDuration($stopwatchEvent->getDuration())->setMemory($stopwatchEvent->getMemory());
         }
     }
     $this->stopwatch->stopSection($event);
     self::$depth--;
 }
开发者ID:bencalie,项目名称:Ciconia,代码行数:33,代码来源:Markdown.php

示例4: onBuildStarted

 /**
  * @param App\CoreBundle\Event\BuildStartedEvent
  */
 public function onBuildStarted(BuildStartedEvent $event)
 {
     $build = $event->getBuild();
     $this->logger->info('starting stopwatch for build #' . $build->getId());
     $this->stopwatch->start($build->getChannel());
     $build->setStartTime(new DateTime());
 }
开发者ID:blazarecki,项目名称:stage1,代码行数:10,代码来源:BuildStopwatchListener.php

示例5: start

 /**
  * @param Event $e
  */
 private function start(Event $e)
 {
     $request = $e['request'];
     $this->requests[$this->hash($request)] = count($this->requests) + 1;
     $name = $this->getEventName($request);
     $this->stopwatch->start($name, 'guzzle');
 }
开发者ID:aciliainternet,项目名称:guzzle-bundle,代码行数:10,代码来源:RequestListener.php

示例6: enter

 /**
  * {@inheritdoc}
  */
 public function enter(\Twig_Profiler_Profile $profile)
 {
     if ($this->stopwatch && $profile->isTemplate()) {
         $this->events[$profile] = $this->stopwatch->start($profile->getName(), 'template');
     }
     parent::enter($profile);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:ProfilerExtension.php

示例7: compile

 /**
  * @return string
  */
 public function compile()
 {
     $this->stopwatch->start('webpack.total');
     $this->stopwatch->start('webpack.prepare');
     // Recompile twig templates where its needed.
     $this->addSplitPoints();
     $this->addResolveConfig();
     // Write the webpack configuration file.
     file_put_contents($this->cache_dir . DIRECTORY_SEPARATOR . 'webpack.config.js', $this->generator->getConfiguration());
     $this->profiler->set('compiler.performance.prepare', $this->stopwatch->stop('webpack.prepare')->getDuration());
     $this->stopwatch->start('webpack.compiler');
     $this->process->run();
     $output = $this->process->getOutput() . $this->process->getErrorOutput();
     $this->profiler->set('compiler.executed', true);
     $this->profiler->set('compiler.successful', strpos($output, 'Error:') === false);
     $this->profiler->set('compiler.last_output', $output);
     if ($this->profiler->get('compiler.successful')) {
         $this->tracker->rebuild();
     }
     // Finally, write some logging for later use.
     file_put_contents($this->cache_dir . DIRECTORY_SEPARATOR . 'webpack.compiler.log', $output);
     $this->profiler->set('compiler.performance.compiler', $this->stopwatch->stop('webpack.compiler')->getDuration());
     $this->profiler->set('compiler.performance.total', $this->stopwatch->stop('webpack.total')->getDuration());
     return $output;
 }
开发者ID:studionone,项目名称:webpack-bundle,代码行数:28,代码来源:Compiler.php

示例8: onBeforeInvoke

 /**
  * @param InvokeEvent $event
  */
 public function onBeforeInvoke(InvokeEvent $event)
 {
     if (!$this->stopwatch) {
         return;
     }
     $this->stopwatch->start('invoke ' . $event->getDirectRequest()->getRequestKey());
 }
开发者ID:teqneers,项目名称:ext-direct,代码行数:10,代码来源:StopwatchListener.php

示例9: log

 /**
  * Logs with an arbitrary level.
  *
  * @param  mixed  $level
  * @param  string $message
  * @param  array  $context
  * @return null
  */
 public function log($level, $message, array $context = array())
 {
     if (null === $this->logger) {
         return;
     }
     $add = true;
     $stackTrace = $this->getStackTrace();
     if (null !== $this->stopwatch) {
         $trace = debug_backtrace();
         $method = $trace[3]['function'];
         $watch = 'Propel Query ' . (count($this->queries) + 1);
         if ('prepare' === $method) {
             $this->isPrepared = true;
             $this->stopwatch->start($watch, 'propel');
             $add = false;
         } elseif ($this->isPrepared) {
             $this->isPrepared = false;
             $event = $this->stopwatch->stop($watch);
         }
     }
     // $trace[2] has no 'object' key if an exception is thrown while executing a query
     if ($add && isset($event) && isset($trace[2]['object'])) {
         $connection = $trace[2]['object'];
         $this->queries[] = array('sql' => $message, 'connection' => $connection->getName(), 'time' => $event->getDuration() / 1000, 'memory' => $event->getMemory(), 'stackTrace' => $stackTrace);
     }
     $this->logger->log($level, $message, $context);
 }
开发者ID:naldz,项目名称:cyberden,代码行数:35,代码来源:PropelLogger.php

示例10: invoke

 /** {@inheritdoc} */
 public function invoke($calls)
 {
     $this->stopwatch->start($this->clientName, 'rpc_call');
     $collection = new TraceableResponseCollection($this->client->invoke($calls), $this->stopwatch, $this->clientName);
     $this->stopwatch->stop($this->clientName);
     return $collection;
 }
开发者ID:bankiru,项目名称:doctrine-api-bundle,代码行数:8,代码来源:TraceableClient.php

示例11: trace

 /**
  * {@inheritdoc}
  */
 public function trace(array $spans)
 {
     $key = count($spans) == 1 ? $spans[0]->getName() : count($spans);
     $key = 'trace (' . $key . ')';
     $this->stopwatch->start($key);
     $this->decoratedTracer->trace($spans);
     $this->stopwatch->stop($key);
 }
开发者ID:sroze,项目名称:tolerance,代码行数:11,代码来源:WatchedTracer.php

示例12: push

 /**
  * @param string|array $data
  * @param string       $routeName
  * @param array[]      $routeParameters
  */
 public function push($data, $routeName, array $routeParameters = array(), array $context = [])
 {
     $eventName = 'push.' . $this->getName();
     $this->stopwatch->start($eventName, 'websocket');
     $this->pusher->push($data, $routeName, $routeParameters, $context);
     $this->stopwatch->stop($eventName);
     $this->dataCollector->collectData($this->stopwatch->getEvent($eventName), $this->getName());
 }
开发者ID:rsrodrig,项目名称:MeetMeSoftware,代码行数:13,代码来源:PusherDecorator.php

示例13: fetchWithNamespace

 /**
  * @inheritDoc
  */
 public function fetchWithNamespace($id, $namespaceId = null)
 {
     self::$stopwatch->start('doctrine_cache_extension_bundle');
     $data = $this->cacheProviderDecorator->fetchWithNamespace($id, $namespaceId);
     self::$stopwatch->stop('doctrine_cache_extension_bundle');
     self::$collectedData[self::$callId++] = new FetchWithNamespaceCacheCollectedData($id, $namespaceId, $data, self::$stopwatch);
     return $data;
 }
开发者ID:emilyreese,项目名称:DoctrineCacheExtensionBundle,代码行数:11,代码来源:DebugCacheProviderDecorator.php

示例14: collectFilter

 /**
  * @param string $function
  * @param array  $arguments
  *
  * @return mixed
  */
 private function collectFilter($function, $arguments)
 {
     $this->stopwatch->start('acl.filters');
     $result = call_user_func_array([$this->aclFilter, $function], $arguments);
     $periods = $this->stopwatch->stop('acl.filters')->getPeriods();
     $this->filters[] = ['method' => $function, 'query' => $result->getSQL(), 'time' => end($periods)->getDuration()];
     return $result;
 }
开发者ID:dragosprotung,项目名称:AclBundle,代码行数:14,代码来源:AclFilterCollector.php

示例15: __call

 /**
  * @internal
  *
  * @param string $name
  * @param array  $arguments
  *
  * @return mixed
  */
 public function __call($name, array $arguments)
 {
     $this->stopwatch->start($this->name, $name);
     $this->logger->debug('> ' . $this->name . '::' . $name, $arguments);
     $r = call_user_func_array([$this->originalClient, $name], $arguments);
     $this->logger->debug('< ' . $this->name . '::' . $name, [$r]);
     $this->stopwatch->stop($this->name);
     return $r;
 }
开发者ID:GeckoPackages,项目名称:GeckoSilexMemcacheService,代码行数:17,代码来源:MemcacheLoggingProxy.php


注:本文中的Symfony\Component\Stopwatch\Stopwatch::start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。