本文整理汇总了PHP中Symfony\Component\HttpKernel\Profiler\Profile::getCollector方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::getCollector方法的具体用法?PHP Profile::getCollector怎么用?PHP Profile::getCollector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpKernel\Profiler\Profile
的用法示例。
在下文中一共展示了Profile::getCollector方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savePerformanceTimingAction
/**
* @param \Symfony\Component\HttpKernel\Profiler\Profile $profile
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
public function savePerformanceTimingAction(Profile $profile, Request $request)
{
$this->profiler->disable();
$data = Json::decode($request->getContent());
/** @var $collector */
$collector = $profile->getCollector('performance_timing');
$collector->setData($data);
$this->profiler->updateProfile($profile);
return new JsonResponse(['success' => TRUE]);
}
示例2: saveStopwatchInfoInProfile
/**
* Update the profiles with the timing info and saves them.
*
* @param Profile $profile The root profile
* @param Boolean $updateChildren Whether to update the children altogether
*/
private function saveStopwatchInfoInProfile(Profile $profile, $updateChildren)
{
$profile->getCollector('time')->setEvents($this->stopwatch->getSectionEvents($profile->getToken()));
$this->profiler->saveProfile($profile);
if ($updateChildren) {
foreach ($profile->getChildren() as $child) {
$this->saveStopwatchInfoInProfile($child, true);
}
}
}
示例3: restCollectorAction
/**
* Exposes collector's data as JSON.
*
* @param \Symfony\Component\HttpKernel\Profiler\Profile $profile
* @param $collector
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
public function restCollectorAction(Profile $profile, $collector)
{
$this->profiler->disable();
$data = $profile->getCollector($collector)->getData();
return new JsonResponse(['data' => $data]);
}
示例4: saveInfoInProfile
/**
* Update the profiles with the timing and events information and saves them.
*
* @param Profile $profile The root profile
* @param Boolean $updateChildren Whether to update the children altogether
*/
private function saveInfoInProfile(Profile $profile, $updateChildren)
{
try {
$collector = $profile->getCollector('memory');
$collector->updateMemoryUsage();
} catch (\InvalidArgumentException $e) {
}
try {
$collector = $profile->getCollector('time');
$collector->setEvents($this->stopwatch->getSectionEvents($profile->getToken()));
} catch (\InvalidArgumentException $e) {
}
try {
$collector = $profile->getCollector('events');
$collector->setCalledListeners($this->getCalledListeners());
$collector->setNotCalledListeners($this->getNotCalledListeners());
} catch (\InvalidArgumentException $e) {
}
$this->profiler->saveProfile($profile);
if ($updateChildren) {
foreach ($profile->getChildren() as $child) {
$this->saveInfoInProfile($child, true);
}
}
}
示例5: assertHasServiceInDIContainer
protected function assertHasServiceInDIContainer(Profile $profile, $serviceName, $RequestedService = array("security.context"))
{
$logMessages = $profile->getCollector("dependency_injection")->getLogMessages();
$servicesDI = array();
if (null !== $logMessages) {
foreach ($logMessages as $k => $message) {
if (in_array($message['id'], $RequestedService)) {
$servicesDI[] = $message['caller']['method'];
}
}
}
$this->assertContains($serviceName, implode(array_values($servicesDI)));
}
示例6: validateCorsResponseDbCount
/**
* @param Profile $profile
*/
protected function validateCorsResponseDbCount(Profile $profile)
{
/** @var DoctrineDataCollector $doctrineDataCollector */
$doctrineDataCollector = $profile->getCollector('db');
$this->assertEquals(0, $doctrineDataCollector->getQueryCount());
}
示例7: validateGetGamesCore
/**
* @param Response $response
* @param Profile $profile
*/
protected function validateGetGamesCore(Response $response, Profile $profile)
{
$this->assertGetJsonCors($response);
/** @var DoctrineDataCollector $doctrineDataCollector */
$doctrineDataCollector = $profile->getCollector('db');
// SELECT user1, SELECT game, [... SELECT user (available game)]
$this->assertGreaterThanOrEqual(2, $doctrineDataCollector->getQueryCount());
}