You are here

public static function MarkdownBenchmark::create in Markdown 3.0.x

Creates a new MarkdownBenchmark instance.

Parameters

string $type: The type of benchmark.

float|\DateTime $start: The start microtime(TRUE).

float|\DateTime $end: The end microtime(TRUE).

mixed $result: The result of what was benchmarked.

Return value

static

5 calls to MarkdownBenchmark::create()
MarkdownBenchmark::invalid in src/MarkdownBenchmark.php
MarkdownBenchmarkAverages::getFallbackBenchmark in src/MarkdownBenchmarkAverages.php
Retrieves a fallback benchmark, creating one if necessary.
MarkdownParserBenchmarkTrait::benchmark in src/Traits/MarkdownParserBenchmarkTrait.php
MarkdownParserBenchmarkTrait::benchmarkParse in src/Traits/MarkdownParserBenchmarkTrait.php
MarkdownParserBenchmarkTrait::benchmarkRender in src/Traits/MarkdownParserBenchmarkTrait.php

File

src/MarkdownBenchmark.php, line 112

Class

MarkdownBenchmark
Class MarkdownBenchmark.

Namespace

Drupal\markdown

Code

public static function create($type = NULL, $start = NULL, $end = NULL, $result = NULL) {
  if ($type === NULL) {
    $type = 'unknown';
  }
  if (!$start instanceof \DateTime) {
    if ($start === NULL) {
      $start = microtime(TRUE);
    }
    $start = \DateTime::createFromFormat('U.u', sprintf('%.6F', (double) $start));
  }
  if (!$end instanceof \DateTime) {
    if ($end === NULL) {
      $end = microtime(TRUE);
    }
    $end = \DateTime::createFromFormat('U.u', sprintf('%.6F', (double) $end));
  }
  return new static($type, $start, $end, $result);
}