Over a million developers have joined DZone.

Caudit : Audit your performance

DZone's Guide to

Caudit : Audit your performance

· Performance Zone
Free Resource

Performance 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 = 

  public void tryOut(){
    final Stopwatch stopwatch = Audits.getBasicStopwatch(BASIC_STOPWATCH_ID);

Output for this stopwach is as follows.

example.basicStopwatch : ElapsedTime[5679]

An example for quantity.

 private final static int NO_OF_RETRIEVED_ITEMS_ID = 

  public void tryOut(){
    final LongQuantity quantity = Audits.
    int size = retrieveItems().size();

Output for this quantity is as follows.

example.noOfRetrievedItems : Quantity[2631]

Dependency for caudit as follows.


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.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}