Example #1
0
 }
 echo "</TABLE>\n";
 # by institution
 # NOTE By-institution jobstats involves OSC site-specific logic.  You may
 # want to comment out the following statement.
 $inst_summary = true;
 if (isset($_POST['institution']) && isset($inst_summary) && $inst_summary == true) {
     echo "<H3>Usage By Institution</H#>\n";
     $result = get_metric($db, $_POST['system'], 'institution', 'usage', $_POST['start_date'], $_POST['end_date']);
     metric_as_table($result, 'institution', 'usage');
     if (isset($_POST['xls'])) {
         $xlsresult = get_metric($db, $_POST['system'], 'institution', 'usage', $_POST['start_date'], $_POST['end_date']);
         metric_as_xls($xlsresult, 'institution', 'usage', $_POST['system'], $_POST['start_date'], $_POST['end_date']);
     }
     if (isset($_POST['ods'])) {
         $odsresult = get_metric($db, $_POST['system'], 'institution', 'usage', $_POST['start_date'], $_POST['end_date']);
         metric_as_ods($odsresult, 'institution', 'usage', $_POST['system'], $_POST['start_date'], $_POST['end_date']);
     }
     ob_flush();
     flush();
 }
 # software usage
 if (isset($_POST['software'])) {
     echo "<H3>Software Usage</H3>\n";
     echo "<TABLE border=1>\n";
     echo "<TR><TH>package</TH><TH>jobcount</TH><TH>cpuhours</TH><TH>users</TH><TH>groups</TH></TR>\n";
     ob_flush();
     flush();
     $first = 1;
     $sql = "";
     foreach ($packages as $pkg) {
Example #2
0
function jobstats_summary($db, $system, $start_date, $end_date)
{
    $result = get_metric($db, $system, "", "cpuhours", $start_date, $end_date);
    $result->fetchInto($row);
    $jobcount = $row[0];
    $cpuhours = $row[1];
    echo "<P><B>" . $jobcount . " jobs run<BR>\n";
    echo $cpuhours . " CPU-hours consumed";
    $nproc = nprocs($system);
    if ($nproc > 0) {
        $data = ndays($db, $system, $start_date, $end_date);
        $ndays = $data[0];
        $cpuhours_avail = $data[1];
        if ($ndays > 0) {
            $avgutil = 100.0 * $cpuhours / $cpuhours_avail;
            printf(" (avg. %6.2f%% utilization over %d days)", $avgutil, $ndays);
        }
    }
    echo "<BR>\n";
    $usercount = get_metric($db, $system, "", "usercount", $start_date, $end_date);
    $usercount->fetchInto($counts);
    $nusers = $counts[1];
    $ngroups = $counts[2];
    echo $nusers . " distinct users, " . $ngroups . " distinct groups";
    echo "</B></P>\n";
}