Skip navigation links

Package net.jperf

Perf4J is a performance logging and monitoring framework for Java.

See: Description

Package net.jperf Description

Perf4J is a performance logging and monitoring framework for Java. It allows developers to make simple timing calls around code blocks, and these timing statements can then be aggregated, analyzed and graphed by the Perf4J tools.

Here is a sample of how to integrate timing statements in code:

 // Note in the line below you usually want to instantiate a StopWatch that corresponds
 // to the logging framework of your choice, like a Log4JStopWatch or an Slf4JStopWatch.
 StopWatch stopWatch = new LoggingStopWatch("tagName");
 ... some code ...
 stopWatch.stop(); // jperf lets you use the logging framework of your choice
 
To analyze the logged timing statements you run the log output file through the LogParser, which generates statistical aggregates like mean, standard deviation and transactions per second. Optionally, if you are using the Log4J or java.util.logging frameworks, you can set up helper appenders or handlers which will perform the real-time aggregation and graph generation for you (IMPORTANT custom java.util.logging Handlers are not yet available, to be completed in the next revision of Perf4J). See the net.jperf.log4j and net.jperf.javalog packages for more information.

In addition, many developers will find it most useful to use Perf4J's profiling annotations in the net.jperf.aop package instead of inserting timing statements directly in code. These annotations, together with an AOP framework like AspectJ or Spring AOP, allow developers to add timed blocks without cluttering the main logic of the code.

Skip navigation links

Copyright © 2008–2015 jperf. All rights reserved.