Ejemplo n.º 1
0
function show_stats($brand)
{
    switch ($brand) {
        case 1:
            $x = "HTC Power to Give";
            break;
        default:
            error_page("invalid brand");
    }
    $hosts = BoincHost::enum("os_name='Android' and serialnum like '%{$x}%'");
    $n = 0;
    $t = 0;
    $a = 0;
    foreach ($hosts as $h) {
        $t += $h->total_credit;
        $a += $h->expavg_credit;
        if ($h->expavg_credit > 0.1) {
            $n++;
        }
    }
    page_head("Stats for {$x}");
    start_table();
    row2("Active devices", $n);
    row2("Average daily credit", $a);
    row2("Total credit", $t);
    end_table();
    page_tail();
}
Ejemplo n.º 2
0
function merge_by_name($userid)
{
    $hosts = array();
    $host_list = BoincHost::enum("userid={$userid}");
    foreach ($host_list as $host) {
        $hosts[$host->domain_name][] = $host;
    }
    foreach ($hosts as $hlist) {
        merge_name($hlist);
    }
}
Ejemplo n.º 3
0
function get_top_hosts($offset, $sort_by)
{
    global $hosts_per_page;
    $db = BoincDb::get(true);
    if ($sort_by == "total_credit") {
        $sort_order = "total_credit desc";
    } else {
        $sort_order = "expavg_credit desc";
    }
    return BoincHost::enum(null, "order by {$sort_order} limit {$offset}, {$hosts_per_page}");
}
Ejemplo n.º 4
0
function get_cpu_list()
{
    $models = array();
    $hosts = BoincHost::enum("expavg_credit >= " . MIN_CREDIT);
    foreach ($hosts as $host) {
        $x = new StdClass();
        $x->p_ncpus = $host->p_ncpus;
        $x->p_fpops = $host->p_fpops;
        if (!array_key_exists($host->p_model, $models)) {
            $models[$host->p_model] = array();
        }
        $models[$host->p_model][] = $x;
    }
    // for each model, find the median FLOPS
    $m2 = array();
    foreach ($models as $model => $list) {
        $n = sizeof($list);
        if ($n < MIN_COUNT) {
            continue;
        }
        uasort($list, 'compare');
        $m = (int) ($n / 2);
        $total_cores = 0;
        foreach ($list as $l) {
            $total_cores += $l->p_ncpus;
        }
        $x = $list[$m]->p_fpops;
        $y = new StdClass();
        $y->model = $model;
        $y->p_fpops = $x;
        $y->mean_ncores = $total_cores / $n;
        $y->nhosts = $n;
        $m2[] = $y;
        //echo "$model: $x GFLOPS ($n samples)\n";
    }
    uasort($m2, 'compare');
    $x = new StdClass();
    $x->cpus = $m2;
    $x->time = time();
    return $x;
    foreach ($m2 as $x) {
        $g = $x->p_fpops / 1000000000.0;
        echo "{$x->model}: {$g} gflops {$x->mean_ncores} cores {$x->nhosts} hosts \n";
    }
}
Ejemplo n.º 5
0
function estimated_makespan($njobs, $flops_per_job)
{
    $nhosts = BoincHost::count("expavg_credit > 1");
    if ($nhosts < 10) {
        $median_flops = 2000000000.0;
    } else {
        $n = (int) ($nhosts / 2);
        $hs = BoincHost::enum("expavg_credit>1 order by p_fpops limit {$n},1");
        $h = $hs[0];
        $median_flops = $h->p_fpops;
    }
    if ($njobs < $nhosts) {
        return $flops_per_job / $median_flops;
    } else {
        $k = (int) (($njobs + $nhosts - 1) / $nhosts);
        return $k * $flops_per_job / $median_flops;
    }
}
Ejemplo n.º 6
0
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/host.inc";
check_get_args(array("hostid", "detail"));
$user = get_logged_in_user();
$hostid = get_int("hostid");
$host = BoincHost::lookup_id($hostid);
if (!$host || $host->userid != $user->id) {
    error_page("We have no record of that computer");
}
$detail = get_int('detail', true);
page_head(tra("Merge computers"));
$t = time_str($host->create_time);
echo tra("Sometimes BOINC assigns separate identities to the same computer by mistake. You can correct this by merging old identities with the newest one.") . "\n    <form name=host_list action=host_edit_action.php>\n    <input type=hidden name=id_0 value={$hostid}>\n    <p>\n";
$all_hosts = BoincHost::enum("userid={$user->id}");
$nhosts = 1;
$hosts = array();
foreach ($all_hosts as $host2) {
    if ($host->id == $host2->id) {
        continue;
    }
    if (!hosts_compatible($host, $host2, $detail)) {
        continue;
    }
    $hosts[] = $host2;
    $nhosts++;
    if ($nhosts == 500) {
        break;
    }
}
Ejemplo n.º 7
0
        exit;
    }
    $private = false;
} else {
    $user = get_logged_in_user();
    $caching = false;
    $userid = $user->id;
    page_head("Your computers");
    more_or_less($sort, $rev, $show_all);
    user_host_table_start(true, $sort, $rev, $show_all);
    $private = true;
}
$now = time();
$old_hosts = 0;
$i = 1;
$hosts = BoincHost::enum("userid={$userid} order by {$sort_clause}");
foreach ($hosts as $host) {
    $is_old = false;
    if ($now - $host->rpc_time > 30 * 86400) {
        $is_old = true;
        $old_hosts++;
    }
    if (!$show_all && $is_old) {
        continue;
    }
    show_host_row($host, $i, $private, false);
    $i++;
}
echo "</table>\n";
if ($old_hosts > 0) {
    more_or_less($sort, $rev, $show_all);
Ejemplo n.º 8
0
function analyze_all()
{
    $total = 0;
    $nnv = 0;
    $nati = 0;
    $nboth = 0;
    $hosts = BoincHost::enum("expavg_credit > 10 and serialnum<>''");
    foreach ($hosts as $host) {
        $boinc_vers = parse_vers($host->serialnum);
        if (!$boinc_vers) {
            continue;
        }
        if ($boinc_vers->major < 6) {
            continue;
        }
        if ($boinc_vers->major == 6 && $boinc_vers->minor < 10) {
            continue;
        }
        $total++;
        $has_nv = strstr($host->serialnum, 'CUDA');
        $has_ati = strstr($host->serialnum, 'ATI');
        if ($has_nv) {
            $nnv++;
        }
        if ($has_ati) {
            $nati++;
        }
        if ($has_nv && $has_ati) {
            $nboth++;
        }
    }
    echo "total: {$total} NVIDIA: {$nnv} ATI: {$nati} both: {$nboth}\n";
}