Permalink
Browse files

Save the new hPageInfo array that contains wptid & wptrun.

git-svn-id: http://httparchive.googlecode.com/svn/trunk@1208 fc7d47d3-c008-acd5-f51f-d19787b8a02f
  • Loading branch information...
1 parent 2bda77d commit ebcca22211fdd0410a7cfe2ee33b8787bcfa2a05 stevesoudersorg@gmail.com committed May 2, 2013
Showing with 29 additions and 48 deletions.
  1. +29 −48 patchwork.js
View
@@ -35,58 +35,39 @@ while ($row = mysql_fetch_assoc($result)) {
$sUrls = substr($sUrls, 1); // remove leading ","
mysql_free_result($result);
-// Display a thumbnail of the Top N websites at a certain time in the loading process.
-$query = "select pageid, url, wptid, wptrun from $gPagesTable, $gUrlsTable as u where label='$gLabel1' and urlOrig=url and u.rank > 0 and u.rank <= $maxRank and url in ($sUrls) order by u.rank asc;";
-$result = doQuery($query);
-while ($row = mysql_fetch_assoc($result)) {
- $url = $row['url'];
- $pageid = $row['pageid'];
- $wptid = $row['wptid'];
- $wptrun = $row['wptrun'];
+echoInfo($gLabel1, $sUrls);
+echoInfo($gLabel2, $sUrls);
- $xmlurl = "{$wptServer}xmlResult.php?test=$wptid";
- $xmlstr = fetchUrl($xmlurl);
- $xml = new SimpleXMLElement($xmlstr);
- $frames = $xml->data->run[($wptrun - 1)]->firstView->videoFrames;
- if ( $frames->frame ) {
- $sJS = "";
- foreach($frames->frame as $frame) {
- $ms = floatval($frame->time) * 1000;
- $msMax = max($msMax, $ms);
- $sJS .= ( $sJS ? ", " : "" ) . "$ms: 1"; // must NOT end with a comma - poop
- }
- echo "hPages[$pageid] = {" . $sJS . "};\n";
- }
-}
-mysql_free_result($result);
+echo "\nmsMax = $msMax;\n" .
+ ( $gCallback ? "$gCallback();\n" : "" );
-// Display a thumbnail of the Top N websites at a certain time in the loading process.
-$query = "select pageid, url, wptid, wptrun from $gPagesTable, $gUrlsTable as u where label='$gLabel2' and urlOrig=url and u.rank > 0 and u.rank <= $maxRank and url in ($sUrls) order by u.rank asc;";
-$result = doQuery($query);
-while ($row = mysql_fetch_assoc($result)) {
- $url = $row['url'];
- $pageid = $row['pageid'];
- $wptid = $row['wptid'];
- $wptrun = $row['wptrun'];
- $xmlurl = "{$wptServer}xmlResult.php?test=$wptid";
- $xmlstr = fetchUrl($xmlurl);
- $xml = new SimpleXMLElement($xmlstr);
- $frames = $xml->data->run[($wptrun - 1)]->firstView->videoFrames;
- if ( $frames->frame ) {
- $sJS = "";
- foreach($frames->frame as $frame) {
- $ms = floatval($frame->time) * 1000;
- $msMax = max($msMax, $ms);
- $sJS .= ( $sJS ? ", " : "" ) . "$ms: 1"; // must NOT end with a comma - poop
+function echoInfo($label, $sUrls) {
+ global $gPagesTable, $gUrlsTable, $msMax, $maxRank, $wptServer;
+ // Echo the frame times, wptid, and wptrun info for the pages in JS format.
+ $query = "select pageid, url, wptid, wptrun from $gPagesTable, $gUrlsTable as u where label='$label' and urlOrig=url and u.rank > 0 and u.rank <= $maxRank and url in ($sUrls) order by u.rank asc;";
+ $result = doQuery($query);
+ while ($row = mysql_fetch_assoc($result)) {
+ $url = $row['url'];
+ $pageid = $row['pageid'];
+ $wptid = $row['wptid'];
+ $wptrun = $row['wptrun'];
+
+ $xmlurl = "{$wptServer}xmlResult.php?test=$wptid";
+ $xmlstr = fetchUrl($xmlurl);
+ $xml = new SimpleXMLElement($xmlstr);
+ $frames = $xml->data->run[($wptrun - 1)]->firstView->videoFrames;
+ if ( $frames->frame ) {
+ $sJS = "";
+ foreach($frames->frame as $frame) {
+ $ms = floatval($frame->time) * 1000;
+ $msMax = max($msMax, $ms);
+ $sJS .= ( $sJS ? ", " : "" ) . "$ms: 1"; // must NOT end with a comma - poop
+ }
+ echo "hPages[$pageid] = {" . $sJS . "};\n" .
+ "hPageInfo[$pageid] = ['$wptid', $wptrun];\n";
}
- echo "hPages[$pageid] = {" . $sJS . "};\n";
}
+ mysql_free_result($result);
}
-mysql_free_result($result);
-
-
-
-echo "\nmsMax = Math.max(msMax, $msMax);\n" .
- ( $gCallback ? "$gCallback();\n" : "" );
?>

0 comments on commit ebcca22

Please sign in to comment.