<?php chdir('..'); include 'common.inc'; require_once 'video/avi2frames.inc.php'; require_once 'archive.inc'; set_time_limit(1200); ignore_user_abort(true); header("Content-type: text/plain"); if (ValidateTestId($id)) { $start = microtime(true); RestoreTest($id); ReprocessVideo($id); // If the test was already archived, re-archive it. $testInfo = GetTestInfo($id); if (array_key_exists('archived', $testInfo) && $testInfo['archived']) { $lock = LockTest($id); if (isset($lock)) { $testInfo = GetTestInfo($id); $testInfo['archived'] = false; SaveTestInfo($id, $testInfo); UnlockTest($lock); } ArchiveTest($id); } $end = microtime(true); $elapsed = number_format($end - $start, 3); echo "Done - {$elapsed}s"; } else { echo "Invalid Test ID"; }
function CollectTestResult($test, &$data) { global $benchmark; $id = $test['id']; $count = 0; echo "Reprocessing Test {$id}..."; logMsg("Reprocessing Test {$id}", "./log/reprocess-{$benchmark}.log", true); RestoreTest($id); ReprocessVideo($id); $testPath = './' . GetTestPath($id); $page_data = loadAllPageData($testPath); if (count($page_data)) { foreach ($page_data as $run => &$page_run) { foreach ($page_run as $cached => &$test_data) { $data_row = $test_data; unset($data_row['URL']); // figure out the per-type request info (todo: measure how expensive this is and see if we have a better way) $breakdown = getBreakdown($test['id'], $testPath, $run, $cached, $requests); foreach ($breakdown as $mime => &$values) { $data_row["{$mime}_requests"] = $values['requests']; $data_row["{$mime}_bytes"] = $values['bytes']; } // capture the page speed score if ($cached) { $data_row['page_speed'] = GetPageSpeedScore("{$testPath}/{$run}_Cached_pagespeed.txt"); } else { $data_row['page_speed'] = GetPageSpeedScore("{$testPath}/{$run}_pagespeed.txt"); } $data_row['url'] = $test['url']; $data_row['label'] = $test['label']; $data_row['location'] = $test['location']; $data_row['config'] = $test['config']; $data_row['cached'] = $cached; $data_row['run'] = $run; $data_row['id'] = $test['id']; $data[] = $data_row; $count++; } } } else { $data_row = array(); $data_row['url'] = $test['url']; $data_row['label'] = $test['label']; $data_row['location'] = $test['location']; $data_row['config'] = $test['config']; $data_row['id'] = $test['id']; $data[] = $data_row; } // If the test was already archived, re-archive it. $testInfo = GetTestInfo($id); if (array_key_exists('archived', $testInfo) && $testInfo['archived']) { $lock = LockTest($id); if (isset($lock)) { $testInfo = GetTestInfo($id); $testInfo['archived'] = false; SaveTestInfo($id, $testInfo); UnlockTest($lock); } ArchiveTest($id); } echo "{$count} results\n"; }