forked from HTTPArchive/legacy.httparchive.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trends.inc
85 lines (69 loc) · 3.65 KB
/
trends.inc
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
<?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.
*/
/*
Include file for generating trending charts.
*/
require_once("utils.inc");
require_once("stats.inc");
require_once("charts.inc");
?>
<?php
$device = curDevice();
$gPercentile = getParam("per", ""); // hidden feature: add "&per95" to the URL to see 95th percentile value for SOME trending charts (not: urls, percent charts like percent with GLibs)
$hTrends = getTrends($gSlice, $device, $gUrl);
// Create a chart for each field.
$aRunNames = archiveLabels($gArchive, false);
$aAxisLabels = archiveLabels($gArchive, true, "n/y");
$labels = getLabels($aAxisLabels);
if ( "url" != $gSlice ) {
// show URLs first so people can see if they're doing intersection or not
// but don't show it if we're only looking at a single URL
echo formatChart('numurls', $hTrends, $aRunNames, $labels);
}
// Time is too inconsistent. Only show it if the backdoor querystring param is present:
if ( array_key_exists("plt", $_GET) ) {
echo format2LineChart("renderStart", "onLoad", $hTrends, $aRunNames, $labels, "(ms)", $gPercentile, true, "<div style='margin-left: 2em; font-size:0.9em;'>* Based on limited, synthetic data. See <a href='http://dev.httparchive.org/about.php#accuracy'>FAQ</a> for known biases.</div>", "(ms)");
}
echo format2LineChart("reqTotal", "bytesTotal", $hTrends, $aRunNames, $labels, "(kB)", $gPercentile);
echo format2LineChart("reqHtml", "bytesHtml", $hTrends, $aRunNames, $labels, "(kB)", $gPercentile);
echo format2LineChart("reqJS", "bytesJS", $hTrends, $aRunNames, $labels, "(kB)", $gPercentile);
echo format2LineChart('num_scripts_async', 'num_scripts_sync', $hTrends, $aRunNames, $labels, "", "", true);
echo format2LineChart("reqCSS", "bytesCSS", $hTrends, $aRunNames, $labels, "(kB)", $gPercentile);
echo format2LineChart("reqImg", "bytesImg", $hTrends, $aRunNames, $labels, "(kB)", $gPercentile);
if ( ! $gbMobile ) {
echo format2LineChart("reqFlash", "bytesFlash", $hTrends, $aRunNames, $labels, "(kB)", $gPercentile);
}
echo format2LineChart("reqFont", "bytesFont", $hTrends, $aRunNames, $labels, "(kB)", $gPercentile);
echo format2LineChart("reqOther", "bytesOther", $hTrends, $aRunNames, $labels, "(kB)", $gPercentile);
if ( ! $gbMobile ) {
echo formatChart("_connections", $hTrends, $aRunNames, $labels, $gPercentile);
}
if ( $gbMobile || $gbAndroid || $gbIphone || $gbChrome ) {
// we don't have numDomElements on these devices :-(
echo formatChart("bytesHtmlDoc", $hTrends, $aRunNames, $labels, $gPercentile);
}
else {
echo format2LineChart("numDomElements", "bytesHtmlDoc", $hTrends, $aRunNames, $labels, "(kB)", $gPercentile);
}
echo format2LineChart("maxDomainReqs", "numDomains", $hTrends, $aRunNames, $labels);
echo formatChart("maxage0", $hTrends, $aRunNames, $labels, $gPercentile);
if ( "url" != $gSlice ) {
// TODO - This hardcoded list of DB fields must be synced with the list in getTrendsData().
$aCharts = ( $gbMobile ?
array('perGlibs', 'perFonts', 'perCompressed', 'perHttps', 'perErrors', 'perRedirects') :
array('perGlibs', 'perFlash', 'perFonts', 'perCompressed', 'perHttps', 'perErrors', 'perRedirects', 'perCdn') );
foreach($aCharts as $field) {
echo formatChart($field, $hTrends, $aRunNames, $labels);
}
}
?>