Caudit : Audit your performance
Join the DZone community and get the full member experience.
Join For FreePerformance auditing is an important issue when you deal with an application which requires high performance. As I searched on the web, I could not find a way of doing that, so I have written a performance auditing library called Caudit.
Caudit is a simple library to log application performance, health and statistics in an
organized manner. It has two basic audit types: stopwatches and quantities. Stopwatches
are the ones which you keep track of the time passed for a specific operation. Quantities
are variables that you want to monitor.
In general, I have used stopwatches to monitor my threads and quantities to monitor my queue sizes. Let's give some examples to make it more clear.
An example of a stopwatch.
//Mapping audit to integer is for performance //(string comparison vs integer comparison) private final static int BASIC_STOPWATCH_ID = Audits.mapAudit("example.basicStopwatch"); public void tryOut(){ final Stopwatch stopwatch = Audits.getBasicStopwatch(BASIC_STOPWATCH_ID); stopwatch.start(); doSomeWork(); stopwatch.stop(); }
Output for this stopwach is as follows.
example.basicStopwatch : ElapsedTime[5679]
An example for quantity.
private final static int NO_OF_RETRIEVED_ITEMS_ID = Audits.mapAudit("example.noOfRetrievedItems"); public void tryOut(){ final LongQuantity quantity = Audits. getLongQuantity(NO_OF_RETRIEVED_ITEMS_ID); int size = retrieveItems().size(); quantity.increment(size); }
Output for this quantity is as follows.
example.noOfRetrievedItems : Quantity[2631]
Dependency for caudit as follows.
<dependency> <groupId>com.cetsoft</groupId> <artifactId>caudit</artifactId> <version>0.0.7</version> </dependency>
What I do with those stopwatches and quantities is to output to audits to the console, log and etc. For more information, please visit https://github.com/Cetsoft/caudit/ and fork me on github.
Opinions expressed by DZone contributors are their own.
Comments