I am using Perf4J in a client-server application for timing RPC calls. It was quite simple to implement: I only needed to include a few lines of code around the RPC dispatcher servlet to measure each RPC method call. Time measurements are written to a separate log file, aggregated data is kept in memory for usage with the graphing servlet. Configuration was a matter of minutes.
This is an excerpt from the preHandle() method:
request.setAttribute("stopWatch", new CommonsLogStopWatch());
This code from the postHandle() method:
LoggingStopWatch stopWatch = (LoggingStopWatch)request.getAttribute("stopWatch");
stopWatch.stop(methodName);
Here are the relevant sections of my log4j.cfg:
<logger name="org.perf4j.TimingLogger" additivity="false">
<level value="info"/>
<appender-ref ref="CoalescingStatistics"/>
<appender-ref ref="statsAppender"/>
</logger>
<appender name="CoalescingStatistics"
class="org.perf4j.log4j.AsyncCoalescingStatisticsAppender">
<param name="TimeSlice" value="60000"/>
<appender-ref ref="graphPatientChart"/>
</appender>
<appender name="graphPatientChart"
class="org.perf4j.log4j.GraphingStatisticsAppender">
<param name="GraphType" value="Mean"/>
<param name="TagNamesToGraph" value="getPatientChart,idleNotification"/>
</appender>
<appender name="statsAppender" class="org.apache.log4j.DailyRollingFileAppender">
<param name="datePattern" value="'.'yyyy-MM-dd"/>
<param name="file" value="WEB-INF/log/meona-performance.log"/>
<param name="append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n"/>
</layout>
</appender>
I'd like the graphing servlet to be more interactive: It would be nice if I could choose the tags to be included in the graph. Have you come across an UI application that can be used to analyze the time measurement logs?