/** * Draw the waterfall image * * @param TestStepResult $testStepResult Step results to draw the waterfall for * @param resource $img */ function tbnDrawWaterfall($testStepResult, &$img) { global $id; global $testPath; global $run; global $cached; global $url; global $newWidth; global $test; global $step; require_once __DIR__ . '/waterfall.inc'; $requests = $testStepResult->getRequests(); $localPaths = $testStepResult->createTestPaths(); AddRequestScriptTimings($requests, $localPaths->devtoolsScriptTimingFile()); $use_dots = !isset($_REQUEST['dots']) || $_REQUEST['dots'] != 0; $rows = GetRequestRows($requests, $use_dots); $page_events = GetPageEvents($testStepResult->getRawResults()); $bwIn = 0; if (isset($test) && array_key_exists('testinfo', $test) && array_key_exists('bwIn', $test['testinfo'])) { $bwIn = $test['testinfo']['bwIn']; } else { if (isset($test) && array_key_exists('test', $test) && array_key_exists('bwIn', $test['test'])) { $bwIn = $test['test']['bwIn']; } } $options = array('id' => $id, 'path' => $testPath, 'run_id' => $run, 'is_cached' => $cached, 'step_id' => $step, 'use_cpu' => true, 'use_bw' => true, 'max_bw' => $bwIn, 'show_user_timing' => GetSetting('waterfall_show_user_timing'), 'is_thumbnail' => true, 'include_js' => true, 'is_mime' => (bool) GetSetting('mime_waterfalls'), 'width' => $newWidth); $url = $testStepResult->readableIdentifier($url); $pageData = $testStepResult->getRawResults(); $img = GetWaterfallImage($rows, $url, $page_events, $options, $pageData); }
// Get all of the requests; $is_secure = false; $has_locations = false; $use_location_check = false; if (!isset($requests)) { $requests = getRequests($id, $testPath, $run, $cached, $is_secure, $has_locations, $use_location_check); } else { // not multisteps enabled $requests = $requests[$run][$cached]; fixRequests($requests, $id, $testPath, $run, $cached, $is_secure, $has_locations, $use_location_check); } if (@$_REQUEST['type'] == 'connection') { $is_state = true; $rows = GetConnectionRows($requests, $show_labels); } else { $rows = GetRequestRows($requests, $use_dots, $show_labels); } $page_events = GetPageEvents($page_data); $bwIn = 0; if (isset($test) && array_key_exists('testinfo', $test) && array_key_exists('bwIn', $test['testinfo'])) { $bwIn = $test['testinfo']['bwIn']; } else { if (isset($test) && array_key_exists('test', $test) && array_key_exists('bwIn', $test['test'])) { $bwIn = $test['test']['bwIn']; } } $options = array('id' => $id, 'path' => $testPath, 'run_id' => $run, 'is_cached' => $cached, 'use_cpu' => !isset($_REQUEST['cpu']) || $_REQUEST['cpu'] != 0, 'use_bw' => !isset($_REQUEST['bw']) || $_REQUEST['bw'] != 0, 'show_labels' => $show_labels, 'max_bw' => $bwIn, 'is_mime' => $is_mime, 'is_state' => $is_state, 'rowcount' => $rowcount); $im = GetWaterfallImage($rows, $url, $page_events, $options, $page_data); // Spit the image out to the browser. imagepng($im); imagedestroy($im);
/** * Draw the waterfall image * * @param resource $img */ function tbnDrawWaterfall(&$img) { global $id; global $testPath; global $run; global $cached; global $url; global $newWidth; global $test; include 'waterfall.inc'; $is_secure = false; $has_locations = false; $requests = getRequests($id, $testPath, $run, $cached, $is_secure, $has_locations, false); $use_dots = !isset($_REQUEST['dots']) || $_REQUEST['dots'] != 0; $rows = GetRequestRows($requests, $use_dots); $page_data = loadPageRunData($testPath, $run, $cached); $page_events = GetPageEvents($page_data); $bwIn = 0; if (isset($test) && array_key_exists('testinfo', $test) && array_key_exists('bwIn', $test['testinfo'])) { $bwIn = $test['testinfo']['bwIn']; } else { if (isset($test) && array_key_exists('test', $test) && array_key_exists('bwIn', $test['test'])) { $bwIn = $test['test']['bwIn']; } } $options = array('id' => $id, 'path' => $testPath, 'run_id' => $run, 'is_cached' => $cached, 'use_cpu' => true, 'use_bw' => true, 'max_bw' => $bwIn, 'is_thumbnail' => true, 'width' => $newWidth); $img = GetWaterfallImage($rows, $url, $page_events, $options, $page_data); if (!$requests || !$page_data) { $failed = true; } }