<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ page import="com.google.inject.Injector" %> <%@ page import="net.socialgamer.cah.StartupUtils" %> <%@ page import="net.socialgamer.cah.data.ConnectedUsers" %> <%@ page import="net.socialgamer.cah.data.User" %> <%@ page import="java.util.Collection" %> <%@ page import="java.util.Date" %> <% String remoteAddr = request.getRemoteAddr(); if (!(remoteAddr.equals("0:0:0:0:0:0:0:1") || remoteAddr.equals("127.0.0.1"))) { response.sendError(403, "Access is restricted to known hosts"); } ServletContext servletContext = pageContext.getServletContext(); // process verbose toggle String verboseParam = request.getParameter("verbose"); if (verboseParam != null) { if (verboseParam.equals("on")) { servletContext.setAttribute(StartupUtils.VERBOSE_DEBUG, Boolean.TRUE); } else { servletContext.setAttribute(StartupUtils.VERBOSE_DEBUG, Boolean.FALSE); } } %> CAH - Admin <% Injector injector = (Injector) servletContext.getAttribute(StartupUtils.INJECTOR); %>

Server up since <% Date startedDate = (Date) servletContext.getAttribute(StartupUtils.DATE_NAME); long uptime = System.currentTimeMillis() - startedDate.getTime(); uptime /= 1000l; long seconds = uptime % 60l; long minutes = (uptime / 60l) % 60l; long hours = (uptime / 60l / 60l) % 24l; long days = (uptime / 60l / 60l / 24l); out.print(String.format("%s (%d hours, %02d:%02d:%02d)", startedDate.toString(), days, hours, minutes, seconds)); %>

Stat MiB
In Use <% out.print((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024); %>
Free <% out.print(Runtime.getRuntime().freeMemory() / 1024 / 1024); %>
JVM Allocated <% out.print(Runtime.getRuntime().totalMemory() / 1024 / 1024); %>
JVM Max <% out.print(Runtime.getRuntime().maxMemory() / 1024 / 1024); %>
<% ConnectedUsers connectedUsers = injector.getInstance(ConnectedUsers.class); Collection users = connectedUsers.getUsers(); %>
<% for (User u : users) { %> <% } %>
Username Host
<% out.print(u.getNickname()); %> <% out.print(u.getHostName()); %>
<% Boolean verboseDebugObj = (Boolean) servletContext.getAttribute(StartupUtils.VERBOSE_DEBUG); boolean verboseDebug = verboseDebugObj != null ? verboseDebugObj.booleanValue() : false; %>

Verbose logging is currently <% out.print(verboseDebug ? "ON" : "OFF"); %>. Turn on. Turn off.