Esempio n. 1
0
function merge_name($list)
{
    // find the newest one
    //
    $newest_host = $list[0];
    echo "<br><br>" . tra("Processing %1", $newest_host->domain_name) . "\n";
    foreach ($list as $host) {
        if ($host->create_time > $newest_host->create_time) {
            $newest_host = $host;
        }
    }
    foreach ($list as $host) {
        if ($host->id == $newest_host->id) {
            continue;
        }
        $error = merge_hosts($host, $newest_host);
        if (!$error) {
            echo "<br>" . tra("Merged %1 into %2", $host->id, $newest_host->id) . "\n";
        } else {
            echo "<br>{$error}\n";
        }
        // refresh from DB (otherwise credit increments get lost)
        $newest_host = BoincHost::lookup_id($newest_host->id);
    }
}
Esempio n. 2
0
function get_host($hostid, $user)
{
    $host = BoincHost::lookup_id($hostid);
    if (!$host || $host->userid != $user->id) {
        fail("We have no record of that computer");
    }
    return $host;
}
Esempio n. 3
0
function get_gpu_list($vendor, $alt_vendor = null)
{
    $clause = "plan_class like '%{$vendor}%'";
    if ($alt_vendor) {
        $clause .= " or plan_class like '%{$alt_vendor}%'";
    }
    $avs = BoincAppVersion::enum($clause);
    if (count($avs) == 0) {
        return null;
    }
    $av_ids = "";
    foreach ($avs as $av) {
        $av_ids .= "{$av->id}, ";
    }
    $av_ids .= "0";
    $t = time() - 30 * 86400;
    //echo "start enum $vendor $av_ids\n";
    $results = BoincResult::enum("app_version_id in ({$av_ids}) and create_time > {$t} and elapsed_time>100 limit 500");
    //echo "end enum\n";
    $total = array();
    $win = array();
    $linux = array();
    $mac = array();
    foreach ($results as $r) {
        $h = BoincHost::lookup_id($r->hostid);
        if (!$h) {
            continue;
        }
        $wu = BoincWorkunit::lookup_id($r->workunitid);
        if (!$wu) {
            continue;
        }
        $v = $vendor == "cuda" ? "CUDA" : "CAL";
        $model = get_gpu_model($h->serialnum, $v);
        if (!$model) {
            continue;
        }
        add_model($model, $r, $wu, $total);
        if (strstr($h->os_name, "Windows")) {
            add_model($model, $r, $wu, $win);
        }
        if (strstr($h->os_name, "Linux")) {
            add_model($model, $r, $wu, $linux);
        }
        if (strstr($h->os_name, "Darwin")) {
            add_model($model, $r, $wu, $mac);
        }
    }
    $x = null;
    $x->total = $total;
    $x->win = $win;
    $x->linux = $linux;
    $x->mac = $mac;
    return $x;
}
Esempio n. 4
0
    $host_content .= "\n    Total Disk Space: {$y} GB";
    $x = $host->d_free / (1024 * 1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Free Disk Space: {$y} GB\n    Avg network bandwidth (upstream): {$host->n_bwup} bytes/sec\n    Avg network bandwidth (downstream): {$host->n_bwdown} bytes/sec";
    $x = $host->avg_turnaround / 86400;
    $host_content .= "\n    Average turnaround: " . round($x, 2) . " days\n    Number of RPCs: {$host->rpc_seqno}\n    Last RPC: " . time_str($host->rpc_time) . "\n    % of time client on: " . 100 * $host->on_frac . " %\n    % of time host connected: " . 100 * $host->connected_frac . " %\n    % of time user active: " . 100 * $host->active_frac . " %\n    # of results today: " . $host->nresults_today;
    $subject = PROJECT . " notice for {$user->name}";
    $body = PROJECT . " notification:\n\nDear {$user->name}\nYour machine (host # {$host->id}) described below appears to have a misconfigured BOINC\ninstallation.  Could you please have a look at it?\n\nSincerely,\n        The " . PROJECT . " team\n";
    $body .= "\n\nThis is the content of our database:\n" . $host_content . "\n\nFor further information and assistance with " . PROJECT . " go to {$master_url}";
    echo nl2br($body) . "<br><br>";
    return send_email($user, $subject, $body);
}
$hostid = get_int("hostid", true);
if (!$hostid) {
    admin_page_head("Misconfigured Host");
    echo "This script sends an email to the owner of the supplied host which says that something gone wrong with his configuration.<br>";
    echo "<br><form method=\"get\" action=\"problem_host.php\">\n    Host ID: \n    <input type=\"text\" size=\"5\" name=\"hostid\">\n    <input class=\"btn btn-default\" type=\"submit\" value=\"Send Email\">\n    </form>\n    ";
} else {
    $host = BoincHost::lookup_id($hostid);
    if (!$host) {
        echo "<h2>No host with that ID</h2>\n\t \t<center>Please <a href=\"problem_host.php\">try again</a></center>";
    } else {
        $user = BoincUser::lookup_id($host->userid);
        echo "<a href=\"problem_host.php\">Do another?</a><br><br>";
        send_problem_email($user, $host);
        echo "Email to " . $user->email_addr . " has been sent.<br>";
    }
}
admin_page_tail();
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
Esempio n. 5
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 = BoincHost::lookup_id($result->hostid);
            $r = new StdClass();
            $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.\nIt does this by finding the value that minimizes the variance\namong claimed credit for workunits currently in your database.\nIt examines at most {$nwus} WUs (edit the script to change this).\n\nNumber of workunits analyzed: {$n}\n\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 "\nRecommended value: {$fbest}\n";
}