function viewStatistics() { global $submitErr, $submitErrMsg, $user; define("30MIN", 1800); define("1HOUR", 3600); define("2HOURS", 7200); define("4HOURS", 14400); $month1 = processInputVar("month1", ARG_NUMERIC); $day1 = processInputVar("day1", ARG_NUMERIC); $year1 = processInputVar("year1", ARG_NUMERIC); $month2 = processInputVar("month2", ARG_NUMERIC); $day2 = processInputVar("day2", ARG_NUMERIC); $year2 = processInputVar("year2", ARG_NUMERIC); $affilid = processInputVar("affilid", ARG_NUMERIC, $user['affiliationid']); $mode2 = getContinuationVar('mode', 'default'); $provid = processInputVar('provid', ARG_NUMERIC, 0); if ($mode2 == 'provisioning') { $affilid = 0; $provs = getContinuationVar('provs'); if (!array_key_exists($provid, $provs)) { $ids = array_keys($provs); $provid = $ids[0]; } } else { $provid = 0; } $affils = getAffiliations(); if (!checkUserHasPerm('View Statistics by Affiliation') || $affilid != 0 && !array_key_exists($affilid, $affils)) { $affilid = $user['affiliationid']; } if ($affilid == 0) { $statsfor = i("All Affiliations"); } else { $statsfor = $affils[$affilid]; } $start = "{$year1}-{$month1}-{$day1} 00:00:00"; $end = "{$year2}-{$month2}-{$day2} 23:59:59"; if (!checkdate($month1, $day1, $year1)) { $submitErr |= STARTERR; $submitErrMsg[STARTERR] = i("The selected start date is not valid. Please select a valid date.") . "<br>\n"; } if (!checkdate($month2, $day2, $year2)) { $submitErr |= ENDERR; $submitErrMsg[ENDERR] = i("The selected end date is not valid. Please select a valid date.") . "<br>\n"; } if (datetimeToUnix($start) > datetimeToUnix($end)) { $submitErr |= ORDERERR; $submitErrMsg[ORDERERR] = i("The selected end date is before the selected start date. Please select an end date equal to or greater than the start date.") . "<br>\n"; } if ($submitErr) { selectStatistics(); return; } $timestart = microtime(1); if ($mode2 == 'default') { print "<H2>" . i("Statistic Information for") . " {$statsfor}</H2>\n"; } elseif ($mode2 == 'provisioning') { print "<H2>" . i("Statistic Information for") . " {$provs[$provid]}</H2>\n"; } print "<H3>"; $tmp = mktime(0, 0, 0, $month1, $day1, $year1); $starttime = strftime('%x', $tmp); $tmp = mktime(0, 0, 0, $month2, $day2, $year2); $endtime = strftime('%x', $tmp); printf(i("Reservation information between %s and %s:"), $starttime, $endtime); print "</H3>\n"; $reloadid = getUserlistID('vclreload@Local'); if ($mode2 == 'default') { $query = "SELECT l.userid, " . "u.affiliationid, " . "l.nowfuture, " . "UNIX_TIMESTAMP(l.start) AS start, " . "(UNIX_TIMESTAMP(l.loaded) - UNIX_TIMESTAMP(l.start)) AS loadtime, " . "UNIX_TIMESTAMP(l.finalend) AS finalend, " . "l.wasavailable, " . "l.ending, " . "i.prettyname, " . "o.prettyname AS OS " . "FROM log l, " . "image i, " . "user u, " . "OS o " . "WHERE l.start >= '{$start}' AND " . "l.finalend <= '{$end}' AND " . "i.id = l.imageid AND " . "i.OSid = o.id AND " . "l.userid != {$reloadid} AND "; } elseif ($mode2 == 'provisioning') { $query = "SELECT l.userid, " . "u.affiliationid, " . "l.nowfuture, " . "UNIX_TIMESTAMP(l.start) AS start, " . "(UNIX_TIMESTAMP(l.loaded) - UNIX_TIMESTAMP(l.start)) AS loadtime, " . "UNIX_TIMESTAMP(l.finalend) AS finalend, " . "l.wasavailable, " . "l.ending, " . "i.prettyname, " . "o.prettyname AS OS " . "FROM image i, " . "user u, " . "OS o, " . "log l " . "JOIN (" . "SELECT s.logid, " . "MIN(s.computerid) AS computerid " . "FROM sublog s, " . "computer c " . "WHERE s.computerid = c.id AND " . "c.provisioningid = {$provid} " . "GROUP BY logid " . ") AS s ON (s.logid = l.id) " . "WHERE l.start >= '{$start}' AND " . "l.finalend <= '{$end}' AND " . "i.id = l.imageid AND " . "i.OSid = o.id AND " . "l.userid != {$reloadid} AND "; } if ($affilid != 0) { $query .= "u.affiliationid = {$affilid} AND "; } $query .= "l.userid = u.id " . "ORDER BY i.prettyname"; $qh = doQuery($query, 275); $totalreservations = 0; $users = array(); $nows = 0; $futures = 0; $notavailable = 0; $loadtimes = array("2less" => 0, "2to6" => 0, "6to8" => 0, "8more" => 0); $ending = array("deleted" => 0, "released" => 0, "failed" => 0, "noack" => 0, "nologin" => 0, "timeout" => 0, "EOR" => 0, "none" => 0); $imagecount = array(); $imageusers = array(); $imagehours = array(); $imageload2less = array(); $imageload2to6 = array(); $imageload6to8 = array(); $imageload8more = array(); $imagefails = array(); $lengths = array("30min" => 0, "1hour" => 0, "2hours" => 0, "4hours" => 0, "6hours" => 0, "8hours" => 0, "10hours" => 0, "10hrsplus" => 0); $totalhours = 0; $osusers = array(); while ($row = mysql_fetch_assoc($qh)) { if (!array_key_exists($row["prettyname"], $imageload2less)) { $imageload2less[$row["prettyname"]] = 0; } if (!array_key_exists($row["prettyname"], $imageload2to6)) { $imageload2to6[$row["prettyname"]] = 0; } if (!array_key_exists($row["prettyname"], $imageload6to8)) { $imageload6to8[$row["prettyname"]] = 0; } if (!array_key_exists($row["prettyname"], $imageload8more)) { $imageload8more[$row["prettyname"]] = 0; } # notavailable if ($row["wasavailable"] == 0) { $notavailable++; } else { $totalreservations++; # load times if ($row['loadtime'] <= 120) { $loadtimes['2less']++; # imageload2less $imageload2less[$row['prettyname']]++; } elseif ($row['loadtime'] > 120 && $row['loadtime'] <= 360) { $loadtimes['2to6']++; $imageload2to6[$row['prettyname']]++; } elseif ($row['loadtime'] > 360 && $row['loadtime'] <= 480) { $loadtimes['6to8']++; $imageload6to8[$row['prettyname']]++; } else { $loadtimes['8more']++; $imageload8more[$row['prettyname']]++; } } # users $users[$row['userid']] = 1; # nowfuture if ($row["nowfuture"] == "now") { $nows++; } else { $futures++; } # ending $ending[$row["ending"]]++; # imagecount if (!array_key_exists($row["prettyname"], $imagecount)) { $imagecount[$row["prettyname"]] = 0; } $imagecount[$row["prettyname"]]++; # imageusers if (!array_key_exists($row["prettyname"], $imageusers)) { $imageusers[$row["prettyname"]] = array(); } $imageusers[$row['prettyname']][$row['userid']] = 1; # lengths $length = $row["finalend"] - $row["start"]; if ($length < 0) { $length = 0; } if ($length <= 1800) { $lengths["30min"]++; } elseif ($length <= 3600) { $lengths["1hour"]++; } elseif ($length <= 7200) { $lengths["2hours"]++; } elseif ($length <= 14400) { $lengths["4hours"]++; } elseif ($length <= 21600) { $lengths["6hours"]++; } elseif ($length <= 28800) { $lengths["8hours"]++; } elseif ($length <= 36000) { $lengths["10hours"]++; } else { $lengths["10hrsplus"]++; } # imagehours if (!array_key_exists($row["prettyname"], $imagehours)) { $imagehours[$row["prettyname"]] = 0; } $imagehours[$row["prettyname"]] += $length / 3600; # imagefails if (!array_key_exists($row["prettyname"], $imagefails)) { $imagefails[$row["prettyname"]] = 0; } if ($row['ending'] == 'failed') { $imagefails[$row["prettyname"]] += 1; } # total hours $totalhours += $length; # osusers if (!array_key_exists($row["OS"], $osusers)) { $osusers[$row["OS"]] = array(); } $osusers[$row['OS']][$row['userid']] = 1; } print "<DIV align=center>\n"; print "<TABLE>\n"; print " <TR>\n"; print " <TH align=right>" . i("Total Reservations:") . "</TH>\n"; print " <TD>{$totalreservations}</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("Total Hours Used:") . "</TH>\n"; print " <TD>" . (int) ($totalhours / 3600) . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("\"Now\" Reservations:") . "</TH>\n"; print " <TD>{$nows}</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("\"Later\" Reservations:") . "</TH>\n"; print " <TD>{$futures}</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("Unavailable:") . "</TH>\n"; print " <TD>{$notavailable}</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("Load times < 2 minutes:") . "</TH>\n"; print " <TD>{$loadtimes['2less']}</TD>\n"; print " </TR>\n"; print " <TH align=right>" . i("Load times 2-6 minutes:") . "</TH>\n"; print " <TD>{$loadtimes['2to6']}</TD>\n"; print " </TR>\n"; print " <TH align=right>" . i("Load times 6-8 minutes:") . "</TH>\n"; print " <TD>{$loadtimes['6to8']}</TD>\n"; print " <TR>\n"; print " <TH align=right>" . i("Load times >= 8 minutes:") . "</TH>\n"; print " <TD>{$loadtimes['8more']}</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("Total Unique Users:") . "</TH>\n"; print " <TD>" . count($users) . "</TD>\n"; print " </TR>\n"; foreach (array_keys($osusers) as $key) { print " <TR>\n"; print " <TH align=right>"; printf(i("Unique Users of %s:"), $key); print "</TH>\n"; print " <TD>" . count($osusers[$key]) . "</TD>\n"; print " </TR>\n"; } print "</TABLE>\n"; print "<TABLE>\n"; print " <TR>\n"; print " <TD></TD>\n"; print " <TH>" . i("Reservations") . "</TH>\n"; print " <TH>" . i("Unique Users") . "</TH>\n"; print " <TH>" . i("Hours Used") . "</TH>\n"; print " <TH>" . i("< 2 min wait") . "</TH>\n"; print " <TH>" . i("2-6 min wait") . "</TH>\n"; print " <TH>" . i("6-8 min wait") . "</TH>\n"; print " <TH>" . i(">= 8 min wait") . "</TH>\n"; print " <TH>" . i("Failures") . "</TH>\n"; print " </TR>\n"; foreach ($imagecount as $key => $value) { print " <TR>\n"; print " <TH align=right>{$key}:</TH>\n"; print " <TD align=center>{$value}</TD>\n"; print " <TD align=center>" . count($imageusers[$key]) . "</TD>\n"; if ((int) $imagehours[$key] == 0) { print " <TD align=center>1</TD>\n"; } else { print " <TD align=center>" . (int) $imagehours[$key] . "</TD>\n"; } print " <TD align=center>{$imageload2less[$key]}</TD>\n"; print " <TD align=center>{$imageload2to6[$key]}</TD>\n"; print " <TD align=center>{$imageload6to8[$key]}</TD>\n"; print " <TD align=center>{$imageload8more[$key]}</TD>\n"; if ($imagefails[$key]) { $percent = $imagefails[$key] * 100 / $value; if ($percent < 1) { $percent = sprintf('%.1f%%', $percent); } else { $percent = sprintf('%d%%', $percent); } print " <TD align=center><font color=red>{$imagefails[$key]} "; print "({$percent})</font></TD>\n"; } else { print " <TD align=center>{$imagefails[$key]}</TD>\n"; } print " </TR>\n"; } print "</TABLE>\n"; print "<H3>" . i("Durations:") . "</H3>\n"; print "<TABLE>\n"; print " <TR>\n"; print " <TH align=right>" . i("0 - 30 Min:") . "</TH>\n"; print " <TD>" . $lengths["30min"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("30 Min - 1 Hour:") . "</TH>\n"; print " <TD>" . $lengths["1hour"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("1 Hour - 2 Hours:") . "</TH>\n"; print " <TD>" . $lengths["2hours"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("2 Hours - 4 Hours:") . "</TH>\n"; print " <TD>" . $lengths["4hours"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("4 Hours - 6 Hours:") . "</TH>\n"; print " <TD>" . $lengths["6hours"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("6 Hours - 8 Hours:") . "</TH>\n"; print " <TD>" . $lengths["8hours"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("8 Hours - 10 Hours:") . "</TH>\n"; print " <TD>" . $lengths["10hours"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("> 10 Hours:") . "</TH>\n"; print " <TD>" . $lengths["10hrsplus"] . "</TD>\n"; print " </TR>\n"; print "</TABLE>\n"; print "<H3>" . i("Ending information:") . "</H3>\n"; print "<TABLE>\n"; print " <TR>\n"; print " <TH align=right>" . i("Deleted:") . "</TH>\n"; print " <TD>" . $ending["deleted"] . "</TD>\n"; print " <TD rowspan=7><img src=\"images/blank.gif\" width=5></TD>\n"; print " <TD>" . i("(Future reservation deleted before start time reached)") . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("Released:") . "</TH>\n"; print " <TD>" . $ending["released"] . "</TD>\n"; print " <TD>" . i("(Reservation released before end time reached)") . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("Not Acknowledged:") . "</TH>\n"; print " <TD>" . $ending["noack"] . "</TD>\n"; print " <TD>" . i("(\"Connect!\" button never clicked)") . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("No Login:"******"</TH>\n"; print " <TD>" . $ending["nologin"] . "</TD>\n"; print " <TD>" . i("(User never logged in)") . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("End of Reservation:") . "</TH>\n"; print " <TD>" . $ending["EOR"] . "</TD>\n"; print " <TD>" . i("(End of reservation reached)") . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("Timed Out:") . "</TH>\n"; print " <TD>" . $ending["timeout"] . "</TD>\n"; print " <TD>" . i("(Disconnect and no reconnection within 15 minutes)") . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>" . i("Failed:") . "</TH>\n"; print " <TD>" . $ending["failed"] . "</TD>\n"; print " <TD>" . i("(Reserved computer failed to get prepared for user)") . "</TD>\n"; print " </TR>\n"; print "</TABLE>\n"; print "<br>\n"; print "</div>\n"; $unixstart = datetimeToUnix($start); $unixend = datetimeToUnix($end); $start = date('Y-m-d', $unixstart); $end = date('Y-m-d', $unixend); $cdata = array('start' => $start, 'end' => $end, 'affilid' => $affilid, 'mode' => $mode2, 'provid' => $provid); print "<H2>" . i("Reservations by Day") . "</H2>\n"; print "<small>" . i("(Reservations with start time on given day)") . "</small><br>\n"; $cdata['divid'] = 'resbyday'; $cont = addContinuationsEntry('AJgetStatData', $cdata); print "<input type=hidden id=statdaycont value=\"{$cont}\">\n"; print "<div id=\"resbyday\" class=\"statgraph\">(Loading...)</div>\n"; print "<H2>" . i("Max Concurrent Reservations By Day") . "</H2>\n"; $cdata['divid'] = 'maxconcurresday'; $cont = addContinuationsEntry('AJgetStatData', $cdata); print "<input type=hidden id=statconcurrescont value=\"{$cont}\">\n"; print "<div id=\"maxconcurresday\" class=\"statgraph\">Loading graph data...</div>\n"; print "<H2>" . i("Max Concurrent Blade Reservations By Day") . "</H2>\n"; $cdata['divid'] = 'maxconcurbladeday'; $cont = addContinuationsEntry('AJgetStatData', $cdata); print "<input type=hidden id=statconcurbladecont value=\"{$cont}\">\n"; print "<div id=\"maxconcurbladeday\" class=\"statgraph\">Loading graph data...</div>\n"; print "<H2>" . i("Max Concurrent Virtual Machine Reservations By Day") . "</H2>\n"; $cdata['divid'] = 'maxconcurvmday'; $cont = addContinuationsEntry('AJgetStatData', $cdata); print "<input type=hidden id=statconcurvmcont value=\"{$cont}\">\n"; print "<div id=\"maxconcurvmday\" class=\"statgraph\">Loading graph data...</div>\n"; print "<H2>" . i("Reservations by Hour") . "</H2>\n"; print "<small>(" . i("Active reservations during given hour averaged over selected dates") . ")</small><br><br>\n"; $cdata['divid'] = 'resbyhour'; $cont = addContinuationsEntry('AJgetStatData', $cdata); print "<input type=hidden id=statreshourcont value=\"{$cont}\">\n"; print "<div id=\"resbyhour\" class=\"statgraph\">Loading graph data...</div>\n"; $endtime = microtime(1); $end = $endtime - $timestart; #print "running time: $endtime - $timestart = $end<br>\n"; }
function viewStatistics() { global $submitErr, $submitErrMsg, $user, $viewmode; define("30MIN", 1800); define("1HOUR", 3600); define("2HOURS", 7200); define("4HOURS", 14400); $month1 = processInputVar("month1", ARG_NUMERIC); $day1 = processInputVar("day1", ARG_NUMERIC); $year1 = processInputVar("year1", ARG_NUMERIC); $month2 = processInputVar("month2", ARG_NUMERIC); $day2 = processInputVar("day2", ARG_NUMERIC); $year2 = processInputVar("year2", ARG_NUMERIC); $affilid = processInputVar("affilid", ARG_NUMERIC, $user['affiliationid']); $affils = getAffiliations(); if ($viewmode < ADMIN_FULL || $affilid != 0 && !array_key_exists($affilid, $affils)) { $affilid = $user['affiliationid']; } $start = "{$year1}-{$month1}-{$day1} 00:00:00"; $end = "{$year2}-{$month2}-{$day2} 23:59:59"; if (!checkdate($month1, $day1, $year1)) { $submitErr |= STARTERR; $submitErrMsg[STARTERR] = "The selected start date is not valid. Please " . "select a valid date.<br>\n"; } if (!checkdate($month2, $day2, $year2)) { $submitErr |= ENDERR; $submitErrMsg[ENDERR] = "The selected end date is not valid. Please " . "select a valid date.<br>\n"; } if (datetimeToUnix($start) > datetimeToUnix($end)) { $submitErr |= ORDERERR; $submitErrMsg[ORDERERR] = "The selected end date is before the selected " . "start date. Please select an end date equal " . "to or greater than the start date.<br>\n"; } if ($submitErr) { selectStatistics(); return; } $timestart = microtime(1); print "<H2>Statistic Information</H2>\n"; print "<H3>Reservation information between {$month1}/{$day1}/{$year1} and "; print "{$month2}/{$day2}/{$year2}:\n"; print "</H3>\n"; $reloadid = getUserlistID('vclreload@Local'); $query = "SELECT l.userid, " . "l.nowfuture, " . "UNIX_TIMESTAMP(l.start) AS start, " . "(UNIX_TIMESTAMP(l.loaded) - UNIX_TIMESTAMP(l.start)) AS loadtime, " . "UNIX_TIMESTAMP(l.finalend) AS finalend, " . "l.wasavailable, " . "l.ending, " . "i.prettyname, " . "o.prettyname AS OS " . "FROM log l, " . "image i, " . "user u, " . "OS o " . "WHERE l.start >= '{$start}' AND " . "l.finalend <= '{$end}' AND " . "i.id = l.imageid AND " . "i.OSid = o.id AND " . "l.userid != {$reloadid} AND "; if ($affilid != 0) { $query .= "u.affiliationid = {$affilid} AND "; } $query .= "l.userid = u.id " . "ORDER BY i.prettyname"; $qh = doQuery($query, 275); $totalreservations = 0; $users = array(); $nows = 0; $futures = 0; $notavailable = 0; $loadtimes = array("2less" => 0, "2more" => 0); $ending = array("deleted" => 0, "released" => 0, "failed" => 0, "noack" => 0, "nologin" => 0, "timeout" => 0, "EOR" => 0, "none" => 0); $imagecount = array(); $imageusers = array(); $imagehours = array(); $imageload2less = array(); $imageload2more = array(); $lengths = array("30min" => 0, "1hour" => 0, "2hours" => 0, "4hours" => 0, "4hrsplus" => 0); $totalhours = 0; $osusers = array(); while ($row = mysql_fetch_assoc($qh)) { if (!array_key_exists($row["prettyname"], $imageload2less)) { $imageload2less[$row["prettyname"]] = 0; } if (!array_key_exists($row["prettyname"], $imageload2more)) { $imageload2more[$row["prettyname"]] = 0; } # notavailable if ($row["wasavailable"] == 0) { $notavailable++; } else { $totalreservations++; # load times if ($row['loadtime'] < 120) { $loadtimes['2less']++; # imageload2less $imageload2less[$row['prettyname']]++; } else { $loadtimes['2more']++; # imageload2more $imageload2more[$row['prettyname']]++; } } # users $users[$row['userid']] = 1; # nowfuture if ($row["nowfuture"] == "now") { $nows++; } else { $futures++; } # ending $ending[$row["ending"]]++; # imagecount if (!array_key_exists($row["prettyname"], $imagecount)) { $imagecount[$row["prettyname"]] = 0; } $imagecount[$row["prettyname"]]++; # imageusers if (!array_key_exists($row["prettyname"], $imageusers)) { $imageusers[$row["prettyname"]] = array(); } $imageusers[$row['prettyname']][$row['userid']] = 1; # lengths $length = $row["finalend"] - $row["start"]; if ($length <= 1800) { $lengths["30min"]++; } elseif ($length <= 3600) { $lengths["1hour"]++; } elseif ($length <= 7200) { $lengths["2hours"]++; } elseif ($length <= 14400) { $lengths["4hours"]++; } else { $lengths["4hrsplus"]++; } # imagehours if (!array_key_exists($row["prettyname"], $imagehours)) { $imagehours[$row["prettyname"]] = 0; } $imagehours[$row["prettyname"]] += $length / 3600; # total hours $totalhours += $length / 3600; # osusers if (!array_key_exists($row["OS"], $osusers)) { $osusers[$row["OS"]] = array(); } $osusers[$row['OS']][$row['userid']] = 1; } print "<DIV align=center>\n"; print "<TABLE>\n"; print " <TR>\n"; print " <TH align=right>Total Reservations:</TH>\n"; print " <TD>{$totalreservations}</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>Total Hours Used:</TH>\n"; print " <TD>" . (int) $totalhours . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>\"Now\" Reservations:</TH>\n"; print " <TD>{$nows}</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>\"Later\" Reservations:</TH>\n"; print " <TD>{$futures}</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>Unavailable:</TH>\n"; print " <TD>{$notavailable}</TD>\n"; print " </TR>\n"; if ($viewmode >= ADMIN_FULL) { print " <TR>\n"; print " <TH align=right>Load times < 2 minutes:</TH>\n"; print " <TD>{$loadtimes['2less']}</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>Load times >= 2 minutes:</TH>\n"; print " <TD>{$loadtimes['2more']}</TD>\n"; print " </TR>\n"; } print " <TR>\n"; print " <TH align=right>Total Unique Users:</TH>\n"; print " <TD>" . count($users) . "</TD>\n"; print " </TR>\n"; foreach (array_keys($osusers) as $key) { print " <TR>\n"; print " <TH align=right>Unique Users of {$key}:</TH>\n"; print " <TD>" . count($osusers[$key]) . "</TD>\n"; print " </TR>\n"; } print "</TABLE>\n"; print "<TABLE>\n"; print " <TR>\n"; print " <TD></TD>\n"; print " <TH>Reservations</TH>\n"; print " <TH>Unique Users</TH>\n"; print " <TH>Hours Used</TH>\n"; if ($viewmode >= ADMIN_FULL) { print " <TH>< 2 min load time</TH>\n"; print " <TH>>= 2 min load time</TH>\n"; } print " </TR>\n"; foreach ($imagecount as $key => $value) { print " <TR>\n"; print " <TH align=right>{$key}:</TH>\n"; print " <TD align=center>{$value}</TD>\n"; print " <TD align=center>" . count($imageusers[$key]) . "</TD>\n"; if ((int) $imagehours[$key] == 0) { print " <TD align=center>1</TD>\n"; } else { print " <TD align=center>" . (int) $imagehours[$key] . "</TD>\n"; } if ($viewmode >= ADMIN_FULL) { print " <TD align=center>{$imageload2less[$key]}</TD>\n"; print " <TD align=center>{$imageload2more[$key]}</TD>\n"; } print " </TR>\n"; } print "</TABLE>\n"; print "<H3>Durations:</H3>\n"; print "<TABLE>\n"; print " <TR>\n"; print " <TH align=right>0 - 30 Min:</TH>\n"; print " <TD>" . $lengths["30min"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>30 Min - 1 Hour:</TH>\n"; print " <TD>" . $lengths["1hour"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>1 Hour - 2 Hours:</TH>\n"; print " <TD>" . $lengths["2hours"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>2 Hours - 4 Hours:</TH>\n"; print " <TD>" . $lengths["4hours"] . "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>> 4 Hours:</TH>\n"; print " <TD>" . $lengths["4hrsplus"] . "</TD>\n"; print " </TR>\n"; print "</TABLE>\n"; print "<H3>Ending information:</H3>\n"; print "<TABLE>\n"; print " <TR>\n"; print " <TH align=right>Deleted:</TH>\n"; print " <TD>" . $ending["deleted"] . "</TD>\n"; print " <TD rowspan=7><img src=\"images/blank.gif\" width=5></TD>\n"; print " <TD>(Future reservation deleted before start time reached)</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>Released:</TH>\n"; print " <TD>" . $ending["released"] . "</TD>\n"; print " <TD>(Reservation released before end time reached)</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>Not Acknowledged:</TH>\n"; print " <TD>" . $ending["noack"] . "</TD>\n"; print " <TD>(\"Connect!\" button never clicked)</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>No Login:</TH>\n"; print " <TD>" . $ending["nologin"] . "</TD>\n"; print " <TD>(User never logged in)</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>End of Reservation:</TH>\n"; print " <TD>" . $ending["EOR"] . "</TD>\n"; print " <TD>(End of reservation reached)</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>Timed Out:</TH>\n"; print " <TD>" . $ending["timeout"] . "</TD>\n"; print " <TD>(Disconnect and no reconnection within 15 minutes)</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>Failed:</TH>\n"; print " <TD>" . $ending["failed"] . "</TD>\n"; print " <TD>(Reserved computer failed to get prepared for user)</TD>\n"; print " </TR>\n"; print "</TABLE>\n"; print "<br>\n"; $unixstart = datetimeToUnix($start); $unixend = datetimeToUnix($end); $start = date('Y-m-d', $unixstart); $end = date('Y-m-d', $unixend); $cdata = array('start' => $start, 'end' => $end, 'affilid' => $affilid); print "<H2>Reservations by Day</H2>\n"; $cont = addContinuationsEntry('statgraphday', $cdata); print "<img src=" . BASEURL . SCRIPT . "?continuation={$cont}>"; print "<H2>Max Concurrent Reservations By Day</H2>\n"; if ($unixend - $unixstart > SECINMONTH) { print "(this graph only available for up to a month of data)<br>\n"; } else { $cont = addContinuationsEntry('statgraphdayconcuruser', $cdata); print "<img src=" . BASEURL . SCRIPT . "?continuation={$cont}>"; } print "<H2>Max Concurrent Blade Reservations By Day</H2>\n"; if ($unixend - $unixstart > SECINMONTH) { print "(this graph only available for up to a month of data)<br>\n"; } else { $cont = addContinuationsEntry('statgraphdayconcurblade', $cdata); print "<img src=" . BASEURL . SCRIPT . "?continuation={$cont}>"; } print "<H2>Reservations by Hour</H2>\n"; print "(Averaged over the time period)<br><br>\n"; $cont = addContinuationsEntry('statgraphhour', $cdata); print "<img src=" . BASEURL . SCRIPT . "?continuation={$cont}>"; print "</div>\n"; $endtime = microtime(1); $end = $endtime - $timestart; #print "running time: $endtime - $timestart = $end<br>\n"; }