ob_flush(); flush(); } } 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();
function jobstats_output_bucketed_metric($name, $fn, $db, $system, $start_date, $end_date) { if (isset($_POST[$fn . '_graph']) || isset($_POST[$fn . '_table']) || isset($_POST[$fn . '_xls']) || isset($_POST[$fn . '_ods'])) { echo "<H2>" . $name . "</H2>\n"; if (isset($_POST[$fn . '_graph'])) { $result = get_bucketed_metric($db, $system, xaxis($fn), metric($fn), $start_date, $end_date); metric_as_graph($result, xaxis($fn), metric($fn), $system, $start_date, $end_date); } if (isset($_POST[$fn . '_table'])) { $result = get_bucketed_metric($db, $system, xaxis($fn), metric($fn), $start_date, $end_date); metric_as_table($result, xaxis($fn), metric($fn)); } if (isset($_POST[$fn . '_xls'])) { $result = get_bucketed_metric($db, $system, xaxis($fn), metric($fn), $start_date, $end_date); metric_as_xls($result, xaxis($fn), metric($fn), $system, $start_date, $end_date); } if (isset($_POST[$fn . '_ods'])) { $result = get_bucketed_metric($db, $system, xaxis($fn), metric($fn), $start_date, $end_date); metric_as_ods($result, xaxis($fn), metric($fn), $system, $start_date, $end_date); } } }