forked from HTTPArchive/legacy.httparchive.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interesting.php
146 lines (118 loc) · 5.65 KB
/
interesting.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
require_once("ui.inc");
require_once("utils.inc");
$gLabel = getParam('l', latestLabel($gArchive));
$gSlice = getParam('s', 'All');
$gTitle = "Interesting Stats";
?>
<!doctype html>
<html>
<head>
<title><?php echo genTitle($gTitle) ?></title>
<meta charset="UTF-8">
<?php echo headfirst() ?>
<link type="text/css" rel="stylesheet" href="style.css" />
<style>
.chart {
border: 1px solid #BBB;
padding: 4px;
margin-bottom: 40px; }
</style>
</head>
<body>
<?php echo uiHeader($gTitle); ?>
<div style="float:right; margin-right: 10em;">
<a href="about.php#bigquery">Write your own custom queries!</a>
</div>
<h1>Interesting stats</h1>
<p>
Got a stat you'd like to see?
<a href="https://github.com/HTTPArchive/httparchive/issues" target="_blank">Suggest it!</a>
<span style="margin-left: 20px;">New feature: <a href="compare.php">Compare two runs</a></span>
</p>
<?php
if ( $gbDev || $gbDesktop ) {
echo "<p style='font-weight: bold; color: #800; margin-bottom: 1em;'>NOTE: Test agents switched from IE 9 to Chrome as of March 1 2016.</p>\n";
}
else if ( $gbMobile ) {
echo "<p style='font-weight: bold; color: #800; margin-bottom: 1em;'>NOTE: Test agents switched from iPhone 4 to emulated Android as of March 1 2016.</p>\n";
}
?>
<div style="float: left; margin-right: 20px;">
<form>
<label>Choose a run:</label>
<?php echo selectArchiveLabel($gArchive, $gLabel); ?>
</form>
</div>
<form>
<label>Choose URLs:</label>
<?php
echo selectSlice($gSlice, "onchange='document.location=\"?a=$gArchive&l=$gLabel&s=\"+escape(this.options[this.selectedIndex].value)'");
?>
</form>
<div id=interesting style="margin-top: 40px;">
<?php
require_once("stats.inc");
require_once("charts.inc");
$hStats = getStats($gLabel, $gSlice, curDevice());
$hCdf = getCdfData($gLabel, $gSlice, curDevice());
echo bytesContentTypeChart($hStats) . "\n";
echo responseSizes($hStats) . "\n";
echo histogram($hCdf, "bytesHtmlDoc", "HTML Document Transfer Size", "bytesHtmlDoc", 5*1024) . "\n";
echo histogram($hCdf, "numDomElements", "# of DOM Elements per Page", "numDomElements", 400, 2) . "\n";
echo percentGoogleLibrariesAPI($hStats) . "\n";
echo percentFlash($hStats) . "\n";
echo percentFonts($hStats) . "\n";
echo popularImageFormats($hStats) . "\n";
echo maxage($hStats) . "\n";
echo histogram($hCdf, "numRedirects", "Redirects per Page", "redirects") . "\n";
echo histogram($hCdf, "_connections", "Connections per Page", "connections", 10) . "\n";
echo histogram($hCdf, "avg_dom_depth", "Avg DOM Depth", "avgdomdepth") . "\n";
echo histogram($hCdf, "document_height", "Document Height (pixels)", "docheight", 1000) . "\n";
echo histogram($hCdf, "localstorage_size", "Size of localStorage (chars)", "localstorage", 50) . "\n";
echo histogram($hCdf, "sessionstorage_size", "Size of sessionStorage (chars)", "sessionstorage", 50) . "\n";
echo histogram($hCdf, "num_iframes", "Iframes per Page", "numiframes") . "\n";
echo histogram($hCdf, "num_scripts", "Script Tags per Page", "numscripts", 10) . "\n";
echo percentByProtocol($hStats) . "\n";
echo requestErrors($hStats) . "\n";
echo correlationChart($hStats, "renderStart") . "\n";
echo correlationChart($hStats, "SpeedIndex") . "\n";
echo correlationChart($hStats, "onLoad") . "\n";
echo histogram($hCdf, "reqTotal", "Total Requests per Page", "reqTotal", 25) . "\n";
echo histogram($hCdf, "bytesTotal", "Total Transfer Size per Page", "bytesTotal", 1024*1024) . "\n";
echo histogram($hCdf, "reqHtml", "HTML Requests per Page", "reqHtml", 5) . "\n";
echo histogram($hCdf, "bytesHtml", "HTML Transfer Size per Page", "bytesHtml", 20*1024) . "\n";
echo histogram($hCdf, "reqJS", "JS Requests per Page", "reqJS", 5) . "\n";
echo histogram($hCdf, "bytesJS", "JS Transfer Size per Page", "bytesJS", 100*1024, 2) . "\n";
echo histogram($hCdf, "reqCSS", "CSS Requests per Page", "reqCSS", 2) . "\n";
echo histogram($hCdf, "bytesCSS", "CSS Transfer Size per Page", "bytesCSS", 10*1024, 2) . "\n";
echo histogram($hCdf, "reqImg", "Img Requests per Page", "reqImg", 20) . "\n";
echo histogram($hCdf, "bytesImg", "Img Transfer Size per Page", "bytesImg", 400*1024, 2) . "\n";
echo histogram($hCdf, "reqGif", "GIF Requests per Page", "reqGif", 5) . "\n";
echo histogram($hCdf, "bytesGif", "GIF Transfer Size per Page", "bytesGif", 10*1024, 2) . "\n";
echo histogram($hCdf, "reqJpg", "JPG Requests per Page", "reqJpg", 10) . "\n";
echo histogram($hCdf, "bytesJpg", "JPG Transfer Size per Page", "bytesJpg", 200*1024, 2) . "\n";
echo histogram($hCdf, "reqPng", "PNG Requests per Page", "reqPng", 5) . "\n";
echo histogram($hCdf, "bytesPng", "PNG Transfer Size per Page", "bytesPng", 50*1024, 2) . "\n";
echo histogram($hCdf, "reqWebp", "Webp Requests per Page", "reqWebp", 5) . "\n";
echo histogram($hCdf, "bytesWebp", "Webp Transfer Size per Page", "bytesWebp", 5*1024, 2) . "\n";
echo histogram($hCdf, "reqFont", "Font Requests per Page", "reqFont", 2) . "\n";
echo histogram($hCdf, "bytesFont", "Font Transfer Size per Page", "bytesFont", 40*1024, 2) . "\n";
echo histogram($hCdf, "reqVideo", "Video Requests per Page", "reqVideo", 2) . "\n";
echo histogram($hCdf, "bytesVideo", "Video Transfer Size per Page", "bytesVideo", 50*1024) . "\n";
?>
</div>
<?php echo uiFooter() ?>
</body>
</html>