Exemplo n.º 1
0
function get_host($hostid, $user)
{
    $host = lookup_host($hostid);
    if (!$host || $host->userid != $user->id) {
        fail("We have no record of that computer");
    }
    return $host;
}
Exemplo n.º 2
0
function get_data()
{
    $nwus = 4000;
    $sum = array();
    for ($i = 0; $i <= 10; $i++) {
        $sum[] = 0;
    }
    $r1 = mysql_query("select id from workunit where canonical_resultid>0 limit {$nwus}");
    $n = 0;
    while ($wu = mysql_fetch_object($r1)) {
        $results = array();
        $r2 = mysql_query("select * from result where workunitid={$wu->id}");
        $found_zero = false;
        while ($result = mysql_fetch_object($r2)) {
            if ($result->granted_credit == 0) {
                continue;
            }
            // skip invalid
            $host = lookup_host($result->hostid);
            $r = null;
            $r->cpu_time = $result->cpu_time;
            $r->p_fpops = $host->p_fpops;
            $r->p_iops = $host->p_iops;
            $results[] = $r;
        }
        //echo "Wu $wu->id -------------\n";
        if (count($results) < 2) {
            continue;
        }
        for ($i = 0; $i <= 10; $i++) {
            $fpw = $i / 10.0;
            $sum[$i] += fpw_var($results, $fpw);
        }
        $n++;
    }
    echo "This script recommends value for <fp_benchmark_weight> in config.xml.\r\nIt does this by finding the value that minimizes the variance\r\namong claimed credit for workunits currently in your database.\r\nIt examines at most {$nwus} WUs (edit the script to change this).\r\n\r\nNumber of workunits analyzed: {$n}\r\n\r\n";
    for ($i = 0; $i <= 10; $i++) {
        $fpw = $i / 10.0;
        $r = $sum[$i] / $n;
        echo "FP weight {$fpw}: variance is {$r}\n";
        if ($i == 0) {
            $best = $r;
            $fbest = $fpw;
        } else {
            if ($r < $best) {
                $best = $r;
                $fbest = $fpw;
            }
        }
    }
    echo "\r\nRecommended value: {$fbest}\r\n";
}
Exemplo n.º 3
0
<?php

require_once "../inc/db.inc";
require_once "../project/project.inc";
require_once "../inc/util.inc";
require_once "../inc/user.inc";
require_once "../inc/host.inc";
db_init();
$hostid = get_int("hostid");
$host = lookup_host($hostid);
if (!$host) {
    echo "Couldn't find computer";
    exit;
}
$user = get_logged_in_user(false);
if ($user && $user->id == $host->userid) {
    $private = false;
} else {
    $user = null;
    $private = true;
}
$heading = "Computer Triggers for Host # " . $host->id;
//  . " (" . $host->domain_name . ")";
page_head($heading);
show_trigger($host->id, $heading, $private);
page_tail();