diff --git a/dependencies/rasterize.js b/dependencies/rasterize.js index 7eae9de18..138a8d437 100644 --- a/dependencies/rasterize.js +++ b/dependencies/rasterize.js @@ -7,7 +7,7 @@ if (phantom.args.length < 2 || phantom.args.length > 3) { } else { address = phantom.args[0]; output = phantom.args[1]; - page.viewportSize = { width: 600, height: 600 }; + page.viewportSize = { width: 1440, height: 900 }; page.open(address, function (status) { if (status !== 'success') { console.log('Unable to load the address!'); diff --git a/report/properties/page.properties b/report/properties/page.properties new file mode 100644 index 000000000..4fa80288e --- /dev/null +++ b/report/properties/page.properties @@ -0,0 +1,2 @@ +pageDescription=All data for one page. +pageMenu=page \ No newline at end of file diff --git a/report/properties/summary.properties b/report/properties/summary.properties new file mode 100644 index 000000000..f23a65cff --- /dev/null +++ b/report/properties/summary.properties @@ -0,0 +1,2 @@ +pageDescription=An executive summary. +pageMenu=summary \ No newline at end of file diff --git a/report/velocity/header.vm b/report/velocity/header.vm index 7a130589a..802d3b981 100644 --- a/report/velocity/header.vm +++ b/report/velocity/header.vm @@ -33,24 +33,19 @@
-
\ No newline at end of file +
diff --git a/report/velocity/page.vm b/report/velocity/page.vm new file mode 100644 index 000000000..d82a1e71d --- /dev/null +++ b/report/velocity/page.vm @@ -0,0 +1,113 @@ + +#parse("report/velocity/header.vm") + +

Page $document.getRootElement().getChild("u").getValue()

+
+ +

Yslow scores below 100

+ + + + + + + + + + + + #foreach ($message in $document.getRootElement().getChild("g").getChildren()) + + #if($!{message.getChild("score").getValue()}) + + #if($message.getChild("score").getValue()!="100") + + + + + + + + #end + #end + #end + +
+ Rule + + Score + + Message + + Extra +
$message.getName()$message.getChild("score").getValue()$message.getChild("message").getValue() + #foreach ($item in $message.getChild("components").getChildren("item")) +

$item.getValue()

+ #end +
+ +

Page assets

+ + + + + + + + + + + + + #foreach ($asset in $document.getRootElement().getChild("comps").getChildren()) + + + + + + + + + #end + + +
+ url + + type + + size + + expires + + gzip +
+ $asset.getChild("url").getValue() + + #end + "> + + + $asset.getChild("type").getValue() + + $asset.getChild("size").getValue() + + #if($!{asset.getChild("expires")}) + $asset.getChild("expires").getValue() + #else + 0 + #end + + #if($!{asset.getChild("gzip")}) + $asset.getChild("gzip").getValue() + #else + + #end +
+
+ +#parse("report/velocity/footer.vm") + + diff --git a/report/velocity/pages.vm b/report/velocity/pages.vm index f05f6c3bb..5c1bccbc5 100644 --- a/report/velocity/pages.vm +++ b/report/velocity/pages.vm @@ -41,10 +41,15 @@ - - Total requests - + Total request + + Total primed cache request + + + Page load time + + Yslow grade @@ -58,9 +63,15 @@ - $results.getChild("u").getValue() - - $results.getChild("u").getValue() + #end @@ -112,7 +123,14 @@ $results.getChild("r").getValue() - + + + $results.getChild("r_c").getValue() + + + $results.getChild("lt").getValue() + + $results.getChild("o").getValue() diff --git a/report/velocity/summary.vm b/report/velocity/summary.vm new file mode 100644 index 000000000..94bb60b37 --- /dev/null +++ b/report/velocity/summary.vm @@ -0,0 +1,125 @@ + +#parse("report/velocity/header.vm") +
+

Executive summary for $document.getRootElement().getAttribute("url").getValue()

+ +

+ #set($nrOfPages = $document.getRootElement().getChildren().size()) + $nrOfPages pages has been analyzed + + #set($nrOfDecimals = 0) + #set($nrOfJs = 0) + #set($nrOfCss = 0) + #set($nrOfCssImages = 0) + #set($nrOfImages = 0) + #set($nrOfTotalRequests = 0) + #set($nrOfTotalRequestsPrimedCache = 0) + #set($totalPageWeight = 0) + #set($totalLoadTime = 0) + #set($totalScore = 0) + + #foreach ($results in $document.getRootElement().getChildren()) + + #if($!{results.getChild("stats").getChild("js").getChild("r")}) + #set ($nrOfJs = $math.add($nrOfJs, $results.getChild("stats").getChild("js").getChild("r").getValue())) + #end + + #if($!{results.getChild("stats").getChild("css").getChild("r")}) + #set ($nrOfCss = $math.add($nrOfCss,$results.getChild("stats").getChild("css").getChild("r").getValue())) + #end + + #if($!{results.getChild("stats").getChild("cssimage").getChild("r")}) + #set ($nrOfCssImages = $math.add($nrOfCssImages, $results.getChild("stats").getChild("cssimage").getChild("r").getValue())) + #end + + #if($!{results.getChild("stats").getChild("image").getChild("r")}) + #set ($nrOfImages = $math.add($nrOfImages, $results.getChild("stats").getChild("image").getChild("r").getValue())) + #end + + #if($!{results.getChild("r")}) + #set ($nrOfTotalRequests = $math.add($nrOfTotalRequests, $results.getChild("r").getValue())) + #end + + #if($!{results.getChild("r_c")}) + #set ($nrOfTotalRequestsPrimedCache = $math.add($nrOfTotalRequestsPrimedCache, $results.getChild("r_c").getValue())) + #end + + #if($!{results.getChild("w")}) + #set ($totalPageWeight = $math.add($totalPageWeight, $results.getChild("w").getValue())) + #end + + #if($!{results.getChild("lt")}) + #set ($totalLoadTime = $math.add($totalLoadTime, $results.getChild("lt").getValue())) + #end + + #if($!{results.getChild("o")}) + #set ($totalScore = $math.add($totalScore, $results.getChild("o").getValue())) + #end + + #end +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeTotal numberAverage
JS$nrOfJs$math.roundTo($nrOfDecimals,$math.div($nrOfJs,$nrOfPages))
CSS$nrOfCss$math.roundTo($nrOfDecimals,$math.div($nrOfCss,$nrOfPages))
CSS images$nrOfCssImages$math.roundTo($nrOfDecimals,$math.div($nrOfCssImages,$nrOfPages))
Image$nrOfImages$math.roundTo($nrOfDecimals,$math.div($nrOfImages,$nrOfPages))
Requests$nrOfTotalRequests$math.roundTo($nrOfDecimals,$math.div($nrOfTotalRequests,$nrOfPages))
Requests primed cache$nrOfTotalRequestsPrimedCache$math.roundTo($nrOfDecimals,$math.div($nrOfTotalRequestsPrimedCache,$nrOfPages))
Page weight$totalPageWeight$math.roundTo($nrOfDecimals,$math.div($totalPageWeight,$nrOfPages))
Load time$totalLoadTime$math.roundTo($nrOfDecimals,$math.div($totalLoadTime,$nrOfPages))
Score$totalScore$math.roundTo($nrOfDecimals,$math.div($totalScore,$nrOfPages))
+ +
+ +#parse("report/velocity/footer.vm") + + diff --git a/sitespeed.io b/sitespeed.io index c3a4680c0..7cb7ee0d2 100755 --- a/sitespeed.io +++ b/sitespeed.io @@ -62,27 +62,46 @@ done) result=($(printf '%s\n' "${links[@]}"|sort|uniq)) +# Setup dirs REPORT_DIR="sitespeed-result/sitespeed-$HOST-$NOW" REPORT_DATA_DIR="$REPORT_DIR/data" +REPORT_DATA_PAGES_DIR="$REPORT_DATA_DIR/pages" mkdir -p $REPORT_DIR mkdir $REPORT_DATA_DIR +mkdir $REPORT_DATA_PAGES_DIR -echo "Will create result file: $REPORT_DATA_DIR/result.xml" echo '' >> $REPORT_DATA_DIR/result.xml for i in "${result[@]}" do echo "Analyzing $i" - phantomjs dependencies/yslow.js -f xml $i | cut -c39- >> $REPORT_DATA_DIR/result.xml + pagefilename=${i#*//} + pagefilename=$(echo $pagefilename | sed 's/\///g') + + # Striping names from / will make sure urls/files are the same with or without / ending + if [ ! -f "$REPORT_DATA_PAGES_DIR/$pagefilename" ] + then + phantomjs dependencies/yslow.js -f xml $i >> "$REPORT_DATA_PAGES_DIR/$pagefilename" + cat "$REPORT_DATA_PAGES_DIR/$pagefilename" | cut -c39- >> "$REPORT_DATA_DIR/result.xml" + fi done +echo ''>> "$REPORT_DATA_DIR/result.xml" -echo ''>> $REPORT_DATA_DIR/result.xml - -echo 'Create the HTML' - +echo 'Create the result HTML' java -jar dependencies/xml-velocity-1.0-full.jar $REPORT_DATA_DIR/result.xml report/velocity/pages.vm report/properties/pages.properties $REPORT_DIR/report.html +echo 'Create the summary HTML' +java -jar dependencies/xml-velocity-1.0-full.jar $REPORT_DATA_DIR/result.xml report/velocity/summary.vm report/properties/summary.properties $REPORT_DIR/index.html + + +echo 'Create page HTML' +for file in $REPORT_DATA_PAGES_DIR/* +do + filename=$(basename $file) + java -jar dependencies/xml-velocity-1.0-full.jar $file report/velocity/page.vm report/properties/page.properties $REPORT_DIR/$filename.html +done + #copy the rest of the files mkdir $REPORT_DIR/css @@ -93,4 +112,5 @@ cp report/css/* $REPORT_DIR/css cp report/js/* $REPORT_DIR/js cp report/img/* $REPORT_DIR/img -echo "Finished, see the report $REPORT_DIR/report.html" \ No newline at end of file +echo "Finished, see the report $REPORT_DIR/index.html" +exit 0 \ No newline at end of file