function PerformanceTestRecorder::record

Same name in other branches
  1. 10 core/lib/Drupal/Core/Test/PerformanceTestRecorder.php \Drupal\Core\Test\PerformanceTestRecorder::record()
  2. 11.x core/lib/Drupal/Core/Test/PerformanceTestRecorder.php \Drupal\Core\Test\PerformanceTestRecorder::record()

Records the occurrence of an event.

Parameters

string $type: The type of event to record.

string $name: The name of the event to record.

1 call to PerformanceTestRecorder::record()
PerformanceTestRecorder::onRouteBuilderFinish in core/lib/Drupal/Core/Test/PerformanceTestRecorder.php
Records a router rebuild.

File

core/lib/Drupal/Core/Test/PerformanceTestRecorder.php, line 61

Class

PerformanceTestRecorder
Records the number of times specific events occur.

Namespace

Drupal\Core\Test

Code

public function record(string $type, string $name) : void {
    if ($this->state) {
        $record = $this->state
            ->get('drupal.performance_test_recorder', []);
        isset($record[$type][$name]) ? $record[$type][$name]++ : ($record[$type][$name] = 1);
        $this->state
            ->set('drupal.performance_test_recorder', $record);
    }
    else {
        isset(self::$record[$type][$name]) ? self::$record[$type][$name]++ : (self::$record[$type][$name] = 1);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.