".$key."\n"; $sql = "SELECT system, COUNT(jobid) AS jobs, SUM(nproc*TIME_TO_SEC(walltime))/3600.0 AS cpuhours, SUM(TIME_TO_SEC(cput))/3600.0 AS cpuhours_alt, COUNT(DISTINCT(username)) AS users, COUNT(DISTINCT(groupname)) AS groups FROM Jobs WHERE system LIKE '".$_POST['system']."' AND ( "; if ( isset($pkgmatch[$key]) ) { $sql .= $pkgmatch[$key]; } else { $sql .= "script LIKE '%".$key."%' OR software LIKE '%".$key."%'"; } $sql .= " ) AND ( ".dateselect('start',$_POST['start_date'],$_POST['end_date'])." ) GROUP BY system"; if ( $_POST['system']=="%" ) { # compute totals iff wildcarding on all systems $sql .= " UNION SELECT 'TOTAL:',COUNT(jobid) AS jobs, SUM(nproc*TIME_TO_SEC(walltime))/3600.0 AS cpuhours, SUM(TIME_TO_SEC(cput))/3600.0 AS alt_cpuhours, COUNT(DISTINCT(username)) AS users, COUNT(DISTINCT(groupname)) AS groups FROM Jobs WHERE ( "; if ( isset($pkgmatch[$key]) ) { $sql .= $pkgmatch[$key]; } else { $sql .= "script LIKE '%".$key."%' OR software LIKE '%".$key."%'"; } $sql .= " ) AND ( ".dateselect("start",$_POST['start_date'],$_POST['end_date'])." )"; } #echo "
".htmlspecialchars($sql)."
"; $result = db_query($db,$sql); echo "\n"; echo "\n"; while ($result->fetchInto($row)) { $rkeys=array_keys($row); echo ""; foreach ($rkeys as $rkey) { $data[$rkey]=array_shift($row); echo ""; } echo "\n"; } echo "
systemjobscpuhourscpuhours_altusersgroups
".$data[$rkey]."
\n"; } } db_disconnect($db); bookmarkable_url(); } else { begin_form("software-usage.php"); system_chooser(); date_fields(); checkboxes_from_array("Packages",$packages); end_form(); } page_footer(); ?>