1
|
|
|
<?php |
2
|
|
|
// This file is part of BOINC. |
3
|
|
|
// https://boinc.berkeley.edu |
4
|
|
|
// Copyright (C) 2024 University of California |
5
|
|
|
// |
6
|
|
|
// BOINC is free software; you can redistribute it and/or modify it |
7
|
|
|
// under the terms of the GNU Lesser General Public License |
8
|
|
|
// as published by the Free Software Foundation, |
9
|
|
|
// either version 3 of the License, or (at your option) any later version. |
10
|
|
|
// |
11
|
|
|
// BOINC is distributed in the hope that it will be useful, |
12
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
14
|
|
|
// See the GNU Lesser General Public License for more details. |
15
|
|
|
// |
16
|
|
|
// You should have received a copy of the GNU Lesser General Public License |
17
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>. |
18
|
|
|
|
19
|
|
|
// show a (textual) histogram of job sizes in CPU seconds. |
20
|
|
|
|
21
|
|
|
require_once('../inc/boinc_db.inc'); |
22
|
|
|
require_once('../inc/common_defs.inc'); |
23
|
|
|
|
24
|
|
|
function main() { |
25
|
|
|
$ress = BoincResult::enum_fields( |
26
|
|
|
'cpu_time, hostid', |
27
|
|
|
sprintf('outcome=%d and cpu_time>0 order by id desc limit 1000', RESULT_OUTCOME_SUCCESS) |
28
|
|
|
); |
29
|
|
|
$hosts = []; |
30
|
|
|
$samples = []; |
31
|
|
|
foreach ($ress as $res) { |
32
|
|
|
if (array_key_exists($res->hostid, $hosts)) { |
33
|
|
|
$host = $hosts[$res->hostid]; |
34
|
|
|
} else { |
35
|
|
|
$host = BoincHost::lookup_id($res->hostid); |
36
|
|
|
$hosts[$res->hostid] = $host; |
37
|
|
|
} |
38
|
|
|
$fpops = $res->cpu_time * $host->p_fpops; |
39
|
|
|
$samples[] = $res->cpu_time; |
40
|
|
|
//$fpops /= 1e9; |
41
|
|
|
//echo "$res->cpu_time $fpops\n"; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
show($samples); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
function show($samples) { |
48
|
|
|
$x = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; |
49
|
|
|
foreach ($samples as $s) { |
50
|
|
|
$x[(int)log10($s)] += 1; |
51
|
|
|
} |
52
|
|
|
for ($i=0; $i<16; $i++) { |
53
|
|
|
echo sprintf("%d: %d\n", $i, $x[$i]); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
main(); |
58
|
|
|
|
59
|
|
|
?> |
60
|
|
|
|