-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpc_index.php
executable file
·315 lines (279 loc) · 11.7 KB
/
pc_index.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?
# vi: ts=2 sw=2 tw=120 syntax=php
# $Id: pc_index.php,v 1.51 2009/02/27 03:45:10 thejet Exp $
$title = "Overall Project Stats";
include "etc/global.inc";
include "etc/modules.inc";
include "etc/projectstats.php";
include "etc/project.inc";
include "etc/ogrstubspace.php";
####
# Daily summary
$gprojstats = $gproj->get_current_stats();
if (!$gprojstats->_state) {
display_last_update('i');
?>
<div style="text-align:center">
<br />
<p class="phead">
Information not available
</p>
<p>Statistical information for <?=$gproj->get_name()?> is not currently available. A batch update run may not yet
have been completed, or may still be in progress</p>
<p>Please check back later, and apologies for any inconvenience!</p>
<?php
exit();
}
// @todo - this returns date in wrong format for lastupdate
$lastupdate = $gprojstats->get_stats_item('date');
$yest_scaled_work_units = number_format( (double) $gprojstats->get_stats_item('work_units') * $gproj->get_scale());
$yest_unscaled_work_units = number_format( (double) $gprojstats->get_stats_item('work_units'));
$yest_emails = number_format($gprojstats->get_stats_item('participants'));
$yest_teams = number_format($gprojstats->get_stats_item('teams'));
$new_emails = number_format($gprojstats->get_stats_item('participants_new'));
$new_teams = number_format($gprojstats->get_stats_item('teams_new'));
####
# Total work, time working
$time_working_raw = $gprojstats->get_time_working();
$time_working = number_format($gprojstats->get_time_working());
$tot_unscaled_work_units = number_format( (double) $gprojstats->get_tot_units());
$tot_scaled_work_units = number_format( (double) $gprojstats->get_tot_units() * $gproj->get_scale());
$total_emails = number_format($gprojstats->get_total_emails());
$total_teams = number_format($gprojstats->get_total_teams());
####
# Percent complete
$tot_unscaled_units_to_search = number_style_convert($gproj->get_total_units());
$tot_scaled_units_to_search = number_style_convert($gproj->get_total_units() * $gproj->get_scale());
$total_remaining = $gproj->get_total_units() - $gprojstats->get_tot_units();
if ( $gproj->get_total_units() > 0 ) {
$pct_searched = number_format(100*($gprojstats->get_tot_units()/$gproj->get_total_units()),3);
$bar_width = number_format(300*($gprojstats->get_tot_units()/$gproj->get_total_units()),0);
}
####
# Overall Rate
$overall_unscaled_rate = number_format(( ($gprojstats->get_tot_units()) / ($time_working_raw*86400) ),0);
$overall_scaled_rate = number_format(( ($gprojstats->get_tot_units() * $gproj->get_scale()) / ($time_working_raw*86400) ),0);
####
# Yesterday Rate
$yest_unscaled_work_units = number_format($gprojstats->get_stats_item('work_units'));
$yest_scaled_work_units = number_format($gprojstats->get_stats_item('work_units') * $gproj->get_scale());
if ( $gproj->get_total_units() > 0 ) {
$yest_pct = number_format(100*($gprojstats->get_stats_item('work_units') / $gproj->get_total_units()),6);
$yest_pct_remaining = number_format(100*($gprojstats->get_stats_item('work_units') / ($gproj->get_total_units() - $gprojstats->get_tot_units() + $gprojstats->get_stats_item('work_units'))),6);
}
$yest_unscaled_rate = number_format(( ($gprojstats->get_stats_item('work_units')) / (86400) ),0);
$yest_scaled_rate = number_format(( ($gprojstats->get_stats_item('work_units') * $gproj->get_scale()) / (86400) ),0);
$odds = number_format($total_remaining / $gprojstats->get_stats_item('work_units'),0);
###
# Percentage for OGR Phase 1 and Phase 2
if ($gproj->get_type() == 'OGRP2') {
$ogrdb = new DB("dbname=ogr");
$ogrstats = $ogrdb->query_first("SELECT * FROM recent_complete WHERE project_id = " . $gproj->get_id());
if($ogrstats) {
$ogr_rundate = $ogrstats->rundate;
$ogrp1_pct_searched = $ogrstats->tot_pct;
} else {
$ogrp1_pct_searched = 100; // if failed, then just assume 100 since we know its done.
}
$ogrp1_bar_width = number_format(3*$ogrp1_pct_searched, 0);
$ogrp1_pct_link = "cache/ogr_graph_" . $gproj->get_id() . ".png";
}
if ($gproj->get_id() == 24) {
$ogrp2_pct_searched = 100;
$ogrp2_bar_width = number_format(3*$ogrp2_pct_searched, 0);
$ogrp2_pct_link = "http://n0cgi.distributed.net/statistics/ogr/ogr24p2-percent.png";
} elseif ($gproj->get_id() == 25) {
// load up the list of OGR Stubspaces
$stubspaceList =& OGRStubspace::get_stubspace_list($gproj, $gdb);
$cnt = count($stubspaceList);
$totalStubs = 0;
$stubsDone = 0;
$stubsVerified = 0;
for($i = 0; $i < $cnt; $i++)
{
$tmpStats =& $stubspaceList[$i]->get_current_stats();
$totalStubs += $stubspaceList[$i]->get_total_stubs();
$stubsDone += $tmpStats->get_stubs_done();
$stubsVerified += $tmpStats->get_stubs_verified();
unset($tmpStats);
}
if ($stubsDone > 0 && $stubsVerified > 0) {
$ogrp2_pct_searched = round(($stubsDone + $stubsVerified) / ($totalStubs * 2) * 100, 2);
} else {
$ogrp2_pct_searched = 0;
}
$ogrp2_bar_width = number_format(3*$ogrp2_pct_searched, 0);
$ogrp2_pct_link = "#ogrfootnote";
} elseif ($gproj->get_type() =='OGRNG') {
// load up the list of OGR Stubspaces
$stubspaceList =& OGRStubspace::get_stubspace_list($gproj, $gdb);
$cnt = count($stubspaceList);
$totalStubs = 0;
$stubsDone = 0;
$stubsVerified = 0;
for($i = 0; $i < $cnt; $i++)
{
$tmpStats =& $stubspaceList[$i]->get_current_stats();
$totalStubs += $stubspaceList[$i]->get_total_stubs();
$stubsDone += $tmpStats->get_stubs_done();
$stubsVerified += $tmpStats->get_stubs_verified();
unset($tmpStats);
}
if ($stubsDone > 0) {
$ogrng_pct_searched = round(($stubsDone + $stubsVerified) / ($totalStubs * 2) * 100, 2);
if($ogrng_pct_searched == 100 && ($stubsDone + $stubsVerified) < ($totalStubs * 2))
{
$ogrng_pct_searched = 99.99;
}
}
else
{
$ogrng_pct_searched = 0;
}
}
?>
<div style="text-align:center">
<br />
<p class="phead">
Aggregate Statistics
</p>
<table style="margin:auto">
<? if ($gproj->get_total_units() > 0 ) { ?>
<tr>
<td align="left" class="phead2">Total <?=$gproj->get_scaled_unit_name()?> to Search:</td>
<td align="right"><?=$tot_scaled_units_to_search?></td>
</tr>
<? } ?>
<tr>
<td align="left" class="phead2">Total <?=$gproj->get_scaled_unit_name()?> Tested:</td>
<td align="right"><?=$tot_scaled_work_units?></td>
</tr>
<tr>
<td align="left" class="phead2">Overall Rate:</td>
<td align="right"><?=$overall_scaled_rate?> <?=$gproj->get_scaled_unit_name()?>/sec</td>
</tr>
<? if ($gproj->get_total_units() > 0 ) { ?>
<tr>
<td align="left" class="phead2">Total <?=$gproj->get_unscaled_unit_name()?> to Search:</td>
<td align="right"><?=$tot_unscaled_units_to_search?></td>
</tr>
<? } ?>
<tr>
<td align="left" class="phead2">Total <?=$gproj->get_unscaled_unit_name()?> Tested:</td>
<td align="right"><?=$tot_unscaled_work_units?></td>
</tr>
<tr>
<td align="left" class="phead2">Overall Rate:</td>
<td align="right"><?=$overall_unscaled_rate?> <?=$gproj->get_unscaled_unit_name()?>/sec</td>
</tr>
<? if ($gproj->get_id() == 24 || $gproj->get_id() == 25) { ?>
<tr>
<td align="left" class="phead2">Percent Complete (Phase 1):</td>
<td align="right"><a href="<?=$ogrp1_pct_link?>"><?=$ogrp1_pct_searched?>%</a></td>
</tr>
<tr>
<td align="left" class="phead2">Percent Complete (Phase 2):</td>
<?if($gproj->get_id() == 24) {?>
<td align="right"><a href="<?=$ogrp2_pct_link?>"><?= $gproj->get_id() == 25 ? "~" : "" ?><?=$ogrp2_pct_searched?>%</a></td>
<?} else {?>
<td align="right"><a href="project/ogr_status.php"><?= $gproj->get_id() == 25 ? "~" : "" ?><?=$ogrp2_pct_searched?>%</a> <a href="<?=$ogrp2_pct_link?>">**</a></td>
<?}?>
</tr>
<? } elseif (isset($ogrng_pct_searched)) { ?>
<tr>
<td align="left" class="phead2">Percent Complete:</td>
<td align="right"><a href="project/ogr_status.php?project_id=<?=$gproj->get_id()?>">~<?=$ogrng_pct_searched?>%</a></td>
</tr>
<? } elseif ($gproj->get_total_units() > 0) { ?>
<tr>
<td align="left" class="phead2">Percent Complete:</td>
<td align="right"><?=$pct_searched?>%</td>
</tr>
<? } ?>
<tr>
<td align="left" class="phead2">Time Working:</td>
<td align="right"><?=$time_working?> days</td>
</tr>
</table>
<br />
<? if ($gproj->get_total_units() > 0 || $gproj->get_id() == 24 || $gproj->get_id() == 25) { ?>
<p class="phead2">
Progress Meters
</p>
<table style="margin: auto" width="300" border="1" cellspacing="0" cellpadding="0">
<? if ($gproj->get_id() == 24 || $gproj->get_id() == 25) { ?>
<tr>
<td align="left">Phase 1</td>
<td align="left"><img src="/images/bar.jpg" width="<?=max($ogrp1_bar_width,1)?>" height="14" /></td>
</tr>
<tr>
<td align="left">Phase 2</td>
<td align="left"><img src="/images/bar.jpg" width="<?=max($ogrp2_bar_width,1)?>" height="14" /></td>
</tr>
<? } else { ?>
<tr>
<td align="left"><img src="/images/bar.jpg" width="<?=max($bar_width,1)?>" height="14" /></td>
</tr>
<? } ?>
</table>
<br />
<? } ?>
<p class="phead2">
Current Information
</p>
<p>
<?=$yest_scaled_work_units?> <?=$gproj->get_scaled_unit_name()?> were completed yesterday
<? if ($gproj->get_total_units() > 0 ) { ?>
(<?=$yest_pct?>% of the keyspace)(<?=$yest_pct_remaining?>% of the remaining keyspace)<br />
<? } ?>
at a sustained rate of <?=$yest_scaled_rate?> <?=$gproj->get_scaled_unit_name()?>/sec.
</p>
<p>
<?=$yest_unscaled_work_units?> <?=$gproj->get_unscaled_unit_name()?> were completed yesterday
<? if ($gproj->get_total_units() > 0 ) { ?>
(<?=$yest_pct?>% of the keyspace)(<?=$yest_pct_remaining?>% of the remaining keyspace)<br />
<? } ?>
at a sustained rate of <?=$yest_unscaled_rate?> <?=$gproj->get_unscaled_unit_name()?>/sec.
</p>
<? if ($gproj->get_total_units() > 0 ) { ?>
<p>
The odds are 1 in <?=$odds?> that we will wrap this thing<br />
up in the next 24 hours. (This also means that we'll<br />
hit 100% in <?=$odds?> days at yesterday's rate.)
</p>
<? } ?>
<p>
There have been <?=$total_emails?> participants<br />
since the beginning of this project.<br />
<?=$yest_emails?> of them were active yesterday<br />
and of those, <?=$new_emails?>
<? if($new_emails=='1') {
echo ' was a brand-new participant.';
} else {
echo ' were brand-new participants.';
}?>
</p>
<p>
There are <?=$total_teams?> registered teams.<br />
<?=$yest_teams?> of them submitted work units yesterday.<br />
(<?=$new_teams?> of them <?=($new_teams==1 ? 'is' : 'are')?> brand new!)
</p>
<? if ($gproj->get_type() == 'R72') { ?>
<p><a href="http://n0cgi.distributed.net/rc5-proxyinfo.html">Current Proxy Rates</a></p>
<? } elseif ($gproj->get_type() == 'OGRNG') { ?>
<p><a href="http://n0cgi.distributed.net/ogr-proxyinfo.html">Current Proxy Rates</a></p>
<? } elseif ($gproj->get_id() == 3) { ?>
<p><a href="http://n0cgi.distributed.net/statistics/rc5-56/index.html">Additional Stats</a></p>
<? } ?>
<hr />
<?if( $gproj->get_type() == 'OGRP2' ){?>
<a name="ogrfootnote"></a>
<p><font size="-2">
For more information about OGR Phase 1 and Phase 2, please <a href="http://faq.distributed.net/cache/230.html">read our FAQ page</a>.
</font></p>
<br /><br />
<?}?>
</div>
<div class="well">
<?php display_last_update('i'); ?>
</div>