-
Notifications
You must be signed in to change notification settings - Fork 0
/
comparo.php
109 lines (88 loc) · 4.33 KB
/
comparo.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
<?php
if (!defined('ABSPATH'))
exit; // Exit if accessed directly
include("bots.php");
$values = "";
$labels = "";
$tally = $wpdb->get_row("select
AVG(secs) as avg_secs, AVG(sr) as avg_sr, stddev(secs) as stddev_secs, stddev(sr) as stddev_sr, COUNT(secs) as cnt
FROM $table_name where datetime between '$prevdate' and '$date' and secs<30 " . wphpc_get_useragent_exclusion() . wphpc_sql_where_country($country));
?>
<table cellpadding="0" cellspacing="0" style="width: 100%;" class="wphpc_table">
<tr class="wphpc_table_tr">
<td style="width: 50%;">
<h4>end user web browser load speed</h4>
<?php
/*
echo "<p>average: " . number_format($tally->avg_secs, 1, '.', '') . " secs</p><br />";
echo "<p>stddev: " . number_format($tally->stddev_secs, 1, '.', '') . " secs</p><br />";
echo "<p>variance: " . number_format(($tally->stddev_secs * 100) / $tally->avg_secs, 1, '.', '') . " secs</p><br />";
echo "<p>hits: " . $tally->cnt . " (excludes bots)</p><br />";
*/
?>
<canvas id="cvs_compare_secs1" width="400" height="200">
[No canvas support]
</canvas>
<script>
var data=[<?php echo number_format($tally->avg_secs, 1, '.', ''); ?>,<?php echo $compare_secs; ?>,<?php echo $wpdone_secs; ?>];
var max = Math.round(RGraph.arrayMax(data)+0.499);
var scale=0;
if (max <5) scale=1;
var bar = new RGraph.Bar({
id: 'cvs_compare_secs1',
data: [<?php echo number_format($tally->avg_secs, 1, '.', ''); ?>,<?php echo $compare_secs; ?>,<?php echo $wpdone_secs; ?>],
options: {
labels: ['this site','<?php echo $hostingName; ?>','wpDone'],
shadowOffsetx: 2,
shadowOffsety: 2,
shadowBlur: 2,
textAccessible: true,
colors: ['red','green','Gradient(#99f:#27afe9:#058DC7:#058DC7)'],
colorsSequential: true,
title: 'seconds - lower is better',
ymax: max,
ymin: 0,
scaleDecimals : scale,
tooltipsEvent: 'onmousemove',
tooltips: ['<?php echo number_format($tally->avg_secs, 1, '.', ''); ?> seconds','<?php echo $compare_secs; ?> seconds','<?php echo $wpdone_secs; ?> seconds'],
}
}).draw();
</script>
<?php
//echo "0 - 0.5 secs: " . $tally->sec0 . "<br />";
//echo "0.5-1 secs: " . $tally->sec05 . "<br />";
//echo "1-2 secs: " . $tally->sec1 . "<br />";
//echo "2-4 secs: " . $tally->sec2 . "<br />";
//echo "4-7 secs: " . $tally->sec4 . "<br />";
//echo "7-12 secs: " . $tally->sec7 . "<br />";
//echo "12-20 secs: " . $tally->sec12 . "<br />";
//echo "20+ secs: " . $tally->sec99 . "<br />";
?>
<canvas id="cvs_compare_secs2" width="400" height="200" >
[No canvas support]
</canvas>
<script>
var bar = new RGraph.Bar({
id: 'cvs_compare_secs2',
data: [<?php echo number_format( ($tally->stddev_secs * 100) / $tally->avg_secs, 1, '.', ''); ?>,<?php echo $compare_var_secs; ?>,<?php echo $wpdone_var_secs; ?>],
options: {
labels: ['this site','<?php echo $hostingName; ?>','wpDone'],
shadowOffsetx: 2,
shadowOffsety: 2,
shadowBlur: 2,
textAccessible: true,
colors: ['red','green','Gradient(#99f:#27afe9:#058DC7:#058DC7)'],
colorsSequential: true,
title: 'variance % - lower is better',
}
}).draw();
</script>
</td>
<td style="width: 50%;">
<h4>hosting/php Server responses</h4>
<?php
include ("comparo2.php");
?>
</td>
</tr>
</table>