class PerformanceTimingDataCollector in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/DataCollector/PerformanceTimingDataCollector.php \Drupal\webprofiler\DataCollector\PerformanceTimingDataCollector
- 8.2 webprofiler/src/DataCollector/PerformanceTimingDataCollector.php \Drupal\webprofiler\DataCollector\PerformanceTimingDataCollector
- 4.x webprofiler/src/DataCollector/PerformanceTimingDataCollector.php \Drupal\webprofiler\DataCollector\PerformanceTimingDataCollector
Collects data about frontend performance.
Hierarchy
- class \Drupal\webprofiler\DataCollector\PerformanceTimingDataCollector extends \Symfony\Component\HttpKernel\DataCollector\DataCollector implements DrupalDataCollectorInterface uses StringTranslationTrait
Expanded class hierarchy of PerformanceTimingDataCollector
1 string reference to 'PerformanceTimingDataCollector'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses PerformanceTimingDataCollector
File
- webprofiler/
src/ DataCollector/ PerformanceTimingDataCollector.php, line 15
Namespace
Drupal\webprofiler\DataCollectorView source
class PerformanceTimingDataCollector extends DataCollector implements DrupalDataCollectorInterface {
use StringTranslationTrait, DrupalDataCollectorTrait;
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = NULL) {
}
/**
* @param $data
*/
public function setData($data) {
$this->data['performance'] = $data;
}
/**
* {@inheritdoc}
*/
public function getName() {
return 'performance_timing';
}
/**
* {@inheritdoc}
*/
public function getTitle() {
return $this
->t('Performance Timing');
}
/**
* {@inheritdoc}
*/
public function getPanelSummary() {
if (isset($this->data['performance'])) {
$performanceData = new PerformanceTimingData($this->data['performance']);
return $this
->t('TTFB: @ttfb', [
'@ttfb' => sprintf('%.0f ms', $performanceData
->getTtfbTiming()),
]);
}
return NULL;
}
/**
* {@inheritdoc}
*/
public function getIcon() {
return 'iVBORw0KGgoAAAANSUhEUgAAABUAAAAcCAYAAACOGPReAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpi/P//PwO1ARMDDcCooUPEUEYi1AgAcQIQ+0P5H4B4IxAvwKaYmCSqAMT7gbgBajhMrB8qLkCsoQFQQ0CuOw/EBjgsLIAajmEouvdBhukD8UQgdkASwwXuA7EhNEhwuvQ8iXHSj2Q53FBY7BtADVxIoqEfoQYnYJPEF3bEROZ6WDDBvO+ALcCxJCsBAmpA4SuA7P2PBDQUEOGTDTA1TNCYs6dCRgIlxQswQ0GMB0A8nwgv4gqa+VCXgpMWC1QiEerF9WgaDmJJp/OhkUNIHUHQgJ4ecQHkiMKXXALQIowqpdR8pJi/AA0qvC4lFsyHYqK8zzhaRQ8NQwECDABNaU12xhTp2QAAAABJRU5ErkJggg==';
}
/**
* {@inheritdoc}
*/
public function getData() {
$data = $this->data;
if (isset($this->data['performance'])) {
$performanceData = new PerformanceTimingData($this->data['performance']);
$data['performance']['computed']['DNS lookup time'] = $performanceData
->getDNSTiming();
$data['performance']['computed']['TCP handshake time'] = $performanceData
->getTCPTiming();
$data['performance']['computed']['Time to first byte'] = $performanceData
->getTtfbTiming();
$data['performance']['computed']['Data download time'] = $performanceData
->getDataTiming();
$data['performance']['computed']['DOM building time'] = $performanceData
->getDomTiming();
}
return $data;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalDataCollectorInterface:: |
public | function | 1 | |
DrupalDataCollectorInterface:: |
public | function | Returns the libraries needed in detail panel. | 2 |
DrupalDataCollectorInterface:: |
public | function | Returns true if this datacollector has a detail panel. | 2 |
PerformanceTimingDataCollector:: |
public | function | Collects data for the given Request and Response. | |
PerformanceTimingDataCollector:: |
public | function |
Overrides DrupalDataCollectorInterface:: |
|
PerformanceTimingDataCollector:: |
public | function |
Returns the collector icon in base64 format. Overrides DrupalDataCollectorInterface:: |
|
PerformanceTimingDataCollector:: |
public | function |
Returns the name of the collector. Overrides DrupalDataCollectorInterface:: |
|
PerformanceTimingDataCollector:: |
public | function |
Returns the string used in vertical tab summary. Overrides DrupalDataCollectorInterface:: |
|
PerformanceTimingDataCollector:: |
public | function |
Returns the datacollector title. Overrides DrupalDataCollectorInterface:: |
|
PerformanceTimingDataCollector:: |
public | function | ||
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |