%--
- $Revision: 10204 $
- $Date: 2008-04-11 18:44:25 -0400 (Fri, 11 Apr 2008) $
-
- Copyright (C) 2004-2008 Jive Software. All rights reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
<%@ page import="java.text.*"
errorPage="error.jsp"
%>
<%@ page import="org.jivesoftware.database.DbConnectionManager"%>
<%@ page import="org.jivesoftware.util.JiveGlobals"%>
<%@ page import="org.jivesoftware.database.ProfiledConnection"%>
<%@ page import="org.jivesoftware.database.ProfiledConnectionEntry"%>
<%@ page import="org.jivesoftware.util.ParamUtils"%>
<%@ page import="org.jivesoftware.util.LocaleUtils"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<% webManager.init(request, response, session, application, out ); %>
<%! // Global methods, vars
// Default refresh values
static final int[] REFRESHES = {10,30,60,90};
%>
<%
// Get parameters
boolean doClear = request.getParameter("doClear") != null;
String enableStats = ParamUtils.getParameter(request,"enableStats");
int refresh = ParamUtils.getIntParameter(request,"refresh", -1);
boolean doSortByTime = ParamUtils.getBooleanParameter(request,"doSortByTime");
// Var for the alternating colors
int rowColor = 0;
// Clear the statistics
if (doClear) {
ProfiledConnection.resetStatistics();
// Reload the page without params.
response.sendRedirect("server-db-stats.jsp");
}
// Enable/disable stats
if ("true".equals(enableStats) && ! DbConnectionManager.isProfilingEnabled()) {
DbConnectionManager.setProfilingEnabled(true);
// Log the event
webManager.logEvent("enabled db profiling", null);
}
else if ("false".equals(enableStats) && DbConnectionManager.isProfilingEnabled()) {
DbConnectionManager.setProfilingEnabled(false);
// Log the event
webManager.logEvent("disabled db profiling", null);
}
boolean showQueryStats = DbConnectionManager.isProfilingEnabled();
// Number intFormat for pretty printing of large number values and decimals:
NumberFormat intFormat = NumberFormat.getInstance(JiveGlobals.getLocale());
DecimalFormat decFormat = new DecimalFormat("#,##0.00");
%>
<% if (showQueryStats) { %>