2003-03-17 22:37:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function location_form($host) {
|
|
|
|
if ($host->venue == "home") $h = "selected";
|
|
|
|
if ($host->venue == "work") $w = "selected";
|
|
|
|
if ($host->venue == "school") $s = "selected";
|
|
|
|
$x = "<form action=host_venue_action.php>
|
|
|
|
<input type=hidden name=hostid value=$host->id>
|
|
|
|
<select name=venue>
|
|
|
|
<option value=home $h>Home
|
|
|
|
<option value=work $w>Work
|
|
|
|
<option value=school $s>School
|
|
|
|
</select>
|
|
|
|
<input type=submit value=Update>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_host($host, $private) {
|
|
|
|
start_table();
|
2003-03-20 02:05:25 +00:00
|
|
|
row1("Computer information");
|
2003-03-17 22:37:49 +00:00
|
|
|
if ($private) {
|
|
|
|
row2("IP address", "$host->last_ip_addr<br>(same the last $host->nsame_ip_addr times)");
|
|
|
|
row2("Domain name", $host->domain_name);
|
|
|
|
$x = $host->timezone/3600;
|
|
|
|
row2("Time zone", "UTC - $x hours");
|
|
|
|
}
|
2003-03-19 21:01:32 +00:00
|
|
|
if ($private) {
|
|
|
|
row2("Name", $host->domain_name);
|
|
|
|
}
|
2003-03-17 22:37:49 +00:00
|
|
|
row2("Created", time_str($host->create_time));
|
|
|
|
row2("Total Credit", $host->total_credit);
|
|
|
|
row2("Recent average credit", $host->expavg_credit);
|
|
|
|
row2("CPU type", "$host->p_vendor $host->p_model");
|
|
|
|
row2("Number of CPUs", $host->p_ncpus);
|
|
|
|
row2("Operating System", "$host->os_name $host->os_version");
|
|
|
|
$x = $host->m_nbytes/(1024*1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row2("Memory", "$y MB");
|
|
|
|
$x = $host->m_cache/1024;
|
|
|
|
$y = round($x, 2);
|
|
|
|
row2("Cache", "$y KB");
|
|
|
|
|
|
|
|
if ($private) {
|
|
|
|
$x = $host->m_swap/(1024*1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row2("Swap space", "$y MB");
|
|
|
|
$x = $host->d_total/(1024*1024*1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row2("Total disk space", "$y GB");
|
|
|
|
$x = $host->d_free/(1024*1024*1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row2("Free Disk Space", "$y GB");
|
|
|
|
}
|
|
|
|
$x = $host->p_fpops/(1000*1000);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row2("Measured floating point speed", "$y million ops/sec");
|
|
|
|
$x = $host->p_iops/(1000*1000);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row2("Measured integer speed", "$y million ops/sec");
|
|
|
|
$x = $host->p_membw/(1024*1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row2("Measured memory bandwidth", "$y MB/sec");
|
|
|
|
$x = $host->n_bwup/(1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
if ($y > 0) {
|
|
|
|
row2("Average upload rate", "$y KB/sec");
|
|
|
|
} else {
|
|
|
|
row2("Average upload rate", "Unknown");
|
|
|
|
}
|
|
|
|
$x = $host->n_bwdown/(1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
if ($y > 0) {
|
|
|
|
row2("Average download rate", "$y KB/sec");
|
|
|
|
} else {
|
|
|
|
row2("Average download rate", "Unknown");
|
|
|
|
}
|
|
|
|
if ($private) {
|
|
|
|
row2("Number of times client has contacted server", $host->rpc_seqno);
|
|
|
|
row2("Last time contacted server", time_str($host->rpc_time));
|
|
|
|
row2("% of time client is on", 100*$host->on_frac." %");
|
|
|
|
row2("% of time host is connected", 100*$host->connected_frac." %");
|
|
|
|
row2("% of time user is active", 100*$host->active_frac." %");
|
|
|
|
row2("Location", location_form($host));
|
2003-03-21 04:38:55 +00:00
|
|
|
row2("Edit", "<a href=host_edit_form.php?hostid=$host->id>Merge this host</a>");
|
2003-03-17 22:37:49 +00:00
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-03-19 21:01:32 +00:00
|
|
|
function host_table_start($title, $private) {
|
2003-03-17 22:37:49 +00:00
|
|
|
start_table();
|
|
|
|
row1($title, 6);
|
2003-06-18 23:41:31 +00:00
|
|
|
echo "<tr>";
|
2003-03-19 21:01:32 +00:00
|
|
|
if ($private) {
|
2003-03-20 02:05:25 +00:00
|
|
|
echo "<th>Name
|
|
|
|
<br><font size=-2>Click for more info</font>
|
|
|
|
</th>\n
|
|
|
|
";
|
2003-03-19 21:01:32 +00:00
|
|
|
} else {
|
2003-03-20 02:05:25 +00:00
|
|
|
echo "<th>
|
|
|
|
Rank<br><font size=-2>Click for more info</font>
|
|
|
|
</th>
|
|
|
|
";
|
2003-03-19 21:01:32 +00:00
|
|
|
echo "<th>Owner</th>\n";
|
|
|
|
}
|
|
|
|
echo "
|
2003-03-17 22:37:49 +00:00
|
|
|
<th>Recent average credit</th>
|
2003-05-14 23:05:22 +00:00
|
|
|
<th>Total credit</th>
|
2003-03-17 22:37:49 +00:00
|
|
|
<th>CPU type</th>
|
|
|
|
<th>Operating system</th>
|
2003-06-18 23:41:31 +00:00
|
|
|
<th>Results<br><font size=-2>Click for list</font></th>
|
2003-03-17 22:37:49 +00:00
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2003-03-19 21:01:32 +00:00
|
|
|
function show_host_row($host, $i, $private) {
|
2003-03-17 22:37:49 +00:00
|
|
|
$result = mysql_query("select * from user where id = $host->userid");
|
|
|
|
$user = mysql_fetch_object($result);
|
|
|
|
mysql_free_result($result);
|
2003-06-18 23:41:31 +00:00
|
|
|
|
|
|
|
$result = mysql_query("select * from result where hostid = $host->id order by received_time desc limit 1");
|
|
|
|
$last_result = mysql_fetch_object($result);
|
|
|
|
mysql_free_result($result);
|
|
|
|
|
|
|
|
$result = mysql_query("select count(*) as nresults from result where hostid=$host->id");
|
|
|
|
$foobar = mysql_fetch_object($result);
|
|
|
|
$nresults = $foobar->nresults;
|
|
|
|
|
2003-03-17 22:37:49 +00:00
|
|
|
echo "<tr>
|
2003-03-19 21:01:32 +00:00
|
|
|
";
|
|
|
|
if ($private) {
|
2003-03-20 02:05:25 +00:00
|
|
|
echo"<td>
|
2003-06-19 22:38:53 +00:00
|
|
|
<a href=show_host_detail.php?hostid=$host->id&private=1>
|
2003-03-20 02:05:25 +00:00
|
|
|
$host->domain_name</a></td>
|
|
|
|
";
|
2003-03-19 21:01:32 +00:00
|
|
|
} else {
|
2003-03-20 02:05:25 +00:00
|
|
|
echo "<td><a href=show_host_detail.php?hostid=$host->id>$i</a></td>\n";
|
|
|
|
echo "<td><a href=show_user.php?userid=$user->id>$user->name</a></td>\n";
|
2003-03-19 21:01:32 +00:00
|
|
|
}
|
2003-05-14 23:05:22 +00:00
|
|
|
printf("
|
|
|
|
<td>%.4f</td>
|
|
|
|
<td>%.4f</td>
|
|
|
|
<td>%s %s</td>
|
2003-06-18 23:41:31 +00:00
|
|
|
<td>%s %s</td>",
|
2003-05-14 23:05:22 +00:00
|
|
|
$host->expavg_credit, $host->total_credit, $host->p_vendor, $host->p_model,
|
2003-06-18 23:41:31 +00:00
|
|
|
$host->os_name, $host->os_version
|
|
|
|
);
|
|
|
|
echo "<td><a href=results_host.php?hostid=$host->id>$nresults</a>";
|
|
|
|
if ($last_result) {
|
|
|
|
$x = time_str($last_result->received_time);
|
|
|
|
echo "<br><font size=2>Last received: $x</font>\n";
|
|
|
|
}
|
|
|
|
echo "</td></tr>\n";
|
2003-03-17 22:37:49 +00:00
|
|
|
}
|
|
|
|
|
2003-03-21 04:38:55 +00:00
|
|
|
// return true iff it's possible that the hosts are actually
|
|
|
|
// the same machine
|
|
|
|
//
|
|
|
|
function hosts_compatible($host1, $host2) {
|
|
|
|
if ($host2->p_vendor != $host1->p_vendor) return false;
|
|
|
|
if ($host2->p_model != $host1->p_model) return false;
|
|
|
|
if ($host2->os_name != $host1->os_name) return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2003-03-17 22:37:49 +00:00
|
|
|
?>
|