示例#1
0
/**
* 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);
}
示例#2
0
require_once __DIR__ . '/include/TestStepResult.php';
// not functional, but to declare what to expect from common.inc
global $testPath, $run, $cached, $step, $id, $url, $test;
$testInfo = TestInfo::fromFiles($testPath);
$testStepResult = TestStepResult::fromFiles($testInfo, $run, $cached, $step);
$is_mime = isset($_REQUEST['mime']) ? (bool) @$_REQUEST['mime'] : (bool) GetSetting('mime_waterfalls');
$is_state = (bool) @$_REQUEST['state'];
$include_js = isset($_REQUEST['js']) ? (bool) @$_REQUEST['js'] : true;
$use_dots = !isset($_REQUEST['dots']) || $_REQUEST['dots'] != 0;
$show_labels = !isset($_REQUEST['labels']) || $_REQUEST['labels'] != 0;
$rowcount = array_key_exists('rowcount', $_REQUEST) ? $_REQUEST['rowcount'] : 0;
// Get all of the requests;
$requests = $testStepResult->getRequests();
if ($include_js) {
    $localPaths = new TestPaths($testInfo->getRootDirectory(), $run, $cached, $step);
    AddRequestScriptTimings($requests, $localPaths->devtoolsScriptTimingFile());
}
if (@$_REQUEST['type'] == 'connection') {
    $is_state = true;
    $include_js = false;
    $rows = GetConnectionRows($requests, $show_labels);
} else {
    $rows = GetRequestRows($requests, $use_dots, $show_labels);
}
$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'];