Author: maksimkaszynski
Date: 2007-06-15 14:04:49 -0400 (Fri, 15 Jun 2007)
New Revision: 1203
Added:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/CoreRequestBenchmarkFilter.java
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/PhaseDemarcationNotifier.java
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/RequestBenchMarkFilter.java
trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/WEB-INF/web.xml
Log:
added more benchmarked
Added:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/CoreRequestBenchmarkFilter.java
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/CoreRequestBenchmarkFilter.java
(rev 0)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/CoreRequestBenchmarkFilter.java 2007-06-15
18:04:49 UTC (rev 1203)
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package org.richfaces.demo.benchmark;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class CoreRequestBenchmarkFilter extends RequestBenchMarkFilter {
+
+ @Override
+ protected String requestType() {
+ // TODO Auto-generated method stub
+ return "Core request ";
+ }
+}
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/PhaseDemarcationNotifier.java
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/PhaseDemarcationNotifier.java 2007-06-15
15:14:32 UTC (rev 1202)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/PhaseDemarcationNotifier.java 2007-06-15
18:04:49 UTC (rev 1203)
@@ -3,6 +3,8 @@
*/
package org.richfaces.demo.benchmark;
+import java.util.Map;
+
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
@@ -26,9 +28,15 @@
* @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
*/
public void afterPhase(PhaseEvent event) {
+
+ long l = (Long) getRequestMap(event).get(event.getPhaseId().toString());
if (log.isTraceEnabled()) {
log.trace("Phase end " + event.getPhaseId());
}
+
+ if (log.isInfoEnabled()) {
+ log.info(event.getPhaseId() + " took " + (System.currentTimeMillis() - l) +
"ms");
+ }
}
/* (non-Javadoc)
@@ -38,6 +46,8 @@
if (log.isTraceEnabled()) {
log.trace("Phase start " + event.getPhaseId());
}
+ getRequestMap(event).put(event.getPhaseId().toString(), System.currentTimeMillis());
+
}
/* (non-Javadoc)
@@ -46,5 +56,9 @@
public PhaseId getPhaseId() {
return PhaseId.ANY_PHASE;
}
+
+ private Map<String, Object> getRequestMap(PhaseEvent event) {
+ return event.getFacesContext().getExternalContext().getRequestMap();
+ }
}
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/RequestBenchMarkFilter.java
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/RequestBenchMarkFilter.java 2007-06-15
15:14:32 UTC (rev 1202)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/benchmark/RequestBenchMarkFilter.java 2007-06-15
18:04:49 UTC (rev 1203)
@@ -22,7 +22,7 @@
*/
public class RequestBenchMarkFilter implements Filter {
- private Log log = LogFactory.getLog(RequestBenchMarkFilter.class);
+ private Log log = LogFactory.getLog(this.getClass());
/* (non-Javadoc)
* @see javax.servlet.Filter#destroy()
@@ -40,14 +40,17 @@
long startTime = System.currentTimeMillis();
+ log.debug("Request started " + ((HttpServletRequest)
request).getRequestURL());
+
chain.doFilter(request, response);
long endTime = System.currentTimeMillis();
+ log.debug("Request ended " + ((HttpServletRequest)
request).getRequestURL());
- log.debug("Request " +
+ log.debug(requestType() +
((HttpServletRequest) request).getRequestURL() +
- "took " +
+ " took " +
(endTime - startTime) +
"ms");
@@ -60,5 +63,9 @@
// TODO Auto-generated method stub
}
+
+ protected String requestType() {
+ return "Request with filters ";
+ }
}
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/WEB-INF/faces-config.xml 2007-06-15
15:14:32 UTC (rev 1202)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/WEB-INF/faces-config.xml 2007-06-15
18:04:49 UTC (rev 1203)
@@ -204,16 +204,6 @@
</managed-bean>
<managed-bean>
- <managed-bean-name>dataModel</managed-bean-name>
-
<managed-bean-class>org.richfaces.demo.datagrid.bean.ChannelDataModel</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>channel</property-name>
- <value>#{jiraService.channel}</value>
- </managed-property>
- </managed-bean>
-
- <managed-bean>
<managed-bean-name>dataModel2</managed-bean-name>
<managed-bean-class>org.richfaces.demo.datagrid.bean.ChannelDataModel2</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
@@ -223,21 +213,6 @@
</managed-property>
</managed-bean>
- <managed-bean>
- <managed-bean-name>selectionBean</managed-bean-name>
-
<managed-bean-class>org.richfaces.demo.datagrid.bean.SelectionBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>dataModel</property-name>
-
<property-class>org.richfaces.model.ScrollableGridDataModel</property-class>
- <value>#{dataModel}</value>
- </managed-property>
- <managed-property>
- <property-name>channel</property-name>
- <value>#{jiraService.channel}</value>
- </managed-property>
- </managed-bean>
-
<managed-bean>
<managed-bean-name>jiraUserConverter</managed-bean-name>
<managed-bean-class>org.richfaces.demo.converters.JiraUserConverter</managed-bean-class>
Modified: trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/WEB-INF/web.xml 2007-06-15
15:14:32 UTC (rev 1202)
+++ trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/WEB-INF/web.xml 2007-06-15
18:04:49 UTC (rev 1203)
@@ -30,6 +30,11 @@
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
+ <filter>
+ <display-name>Request Metrics</display-name>
+ <filter-name>core-metrics</filter-name>
+
<filter-class>org.richfaces.demo.benchmark.CoreRequestBenchmarkFilter</filter-class>
+ </filter>
<filter-mapping>
<filter-name>metrics</filter-name>
<servlet-name>Faces Servlet</servlet-name>
@@ -44,6 +49,13 @@
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
+ <filter-mapping>
+ <filter-name>core-metrics</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
Show replies by date