public function postProcessRun() { $testerError = null; $secure = false; $haveLocations = false; loadPageRunData($this->testRoot, $this->run, $this->cached); $steps = $this->countSteps(); for ($i = 1; $i <= $steps; $i++) { $rootUrls = UrlGenerator::create(true, "", $this->id, $this->run, $this->cached, $i); $stepPaths = new TestPaths($this->testRoot, $this->run, $this->cached, $i); $requests = getRequestsForStep($stepPaths, $rootUrls, $secure, $haveLocations, true, true); if (isset($requests) && is_array($requests) && count($requests)) { getBreakdownForStep($stepPaths, $rootUrls, $requests); } else { $testerError = 'Missing Results'; } if (is_dir(__DIR__ . '/../google') && is_file(__DIR__ . '/../google/google_lib.inc')) { require_once __DIR__ . '/../google/google_lib.inc'; ParseCsiInfoForStep($stepPaths, true); } GetDevToolsCPUTimeForStep($stepPaths); } return $testerError; }
include __DIR__ . '/common.inc'; require_once __DIR__ . '/object_detail.inc'; require_once __DIR__ . '/page_data.inc'; require_once __DIR__ . '/include/TestInfo.php'; require_once __DIR__ . '/include/TestPaths.php'; require_once __DIR__ . '/include/TestStepResult.php'; require_once __DIR__ . '/include/UrlGenerator.php'; global $testPath, $id, $run, $cached, $step; // defined in common.inc $secure = false; $haveLocations = false; $testInfo = TestInfo::fromFiles($testPath); $localPaths = new TestPaths($testPath, $run, $cached, $step); $urlGenerator = UrlGenerator::create(false, "", $id, $run, $cached, $step); $requests = getRequestsForStep($localPaths, $urlGenerator, $secure, $haveLocations, true); $page_keywords = array('Images', 'Webpagetest', 'Website Speed Test', 'Page Speed'); $page_description = "Website speed test images{$testLabel}."; $userImages = true; ?> <!DOCTYPE html> <html> <head> <title>WebPagetest Page Images<?php echo $testLabel; ?> </title> <?php $gaTemplate = 'Page Images'; include 'head.inc'; ?>
/** * Determine the target TTFB for the given test step * @param TestPaths $localPaths Paths corresponding to this step * @param int $rtt The latency if set, or null * @return int|null The target TTFB or null if it can't get determined */ function getTargetTTFBForStep($localPaths, $rtt) { $target = NULL; // load the object data (unavoidable, we need the socket connect time to the first host) require_once 'object_detail.inc'; $secure = false; $requests = getRequestsForStep($localPaths, null, $secure, $haveLocations, false); if (count($requests)) { // figure out what the RTT is to the server (take the connect time from the first request unless it is over 3 seconds) if (isset($requests[0]['connect_start']) && $requests[0]['connect_start'] >= 0 && isset($requests[0]['connect_end']) && $requests[0]['connect_end'] > $requests[0]['connect_start']) { $rtt = $requests[0]['connect_end'] - $requests[0]['connect_start']; } else { $connect_ms = $requests[0]['connect_ms']; if ($rtt > 0 && (!isset($connect_ms) || $connect_ms > 3000 || $connect_ms < 0)) { $rtt += 100; } else { $rtt = $connect_ms; } } // allow for a minimum of 100ms for the RTT $rtt = max($rtt, 100); $ssl_ms = 0; $i = 0; while (isset($requests[$i])) { if (isset($requests[$i]['contentType']) && (stripos($requests[$i]['contentType'], 'ocsp') !== false || stripos($requests[$i]['contentType'], 'crl') !== false)) { $i++; } else { if ($requests[$i]['is_secure']) { $ssl_ms = $rtt; } break; } } // RTT's: DNS + Socket Connect + HTTP Request + 100ms allowance $target = $rtt * 3 + $ssl_ms + 100; } return $target; }
public function getRequests() { // TODO: move implementation to this method return getRequestsForStep($this->localPaths, $this->createUrlGenerator(""), $secure, $haveLocations, false, true); }