Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Generate Benchmark Graphs Easily

DZone's Guide to

Generate Benchmark Graphs Easily

· Java Zone ·
Free Resource

Build vs Buy a Data Quality Solution: Which is Best for You? Gain insights on a hybrid approach. Download white paper now!

After launching a lot of benchmarks for the file copy benchmark and always generating the graphs from the results in Excel, I realized that I was losing a lot of time. So like any Java developer, I decided to create a little tool that would do the work automatically for me. For creating benchmarks, I’m using a little micro-benchmarking framework, described here. After the results are generated, I automatically generate a bar chart of the results using JFreeChart.

Here is an example of graph generated by the tool :

Example graph

Example graph

Usage of the library

The usage is quite simple. By example, if you want to benchmark two methods :

public void method1(){
    //Code...
}

public void method2(){
    //Code...
}

Start creating a Benchs :

Benchs benchs = new Benchs("Title of the benchmark");

benchs.setFolder("folder_path");

folder_path indicates the folder were the graphs will be generated.

And let’s start the benchs :

benchs.bench("First method", new Runnable(){
    public void run() {
        method1();
    }
});

benchs.bench("Second method", new Runnable(){
    public void run() {
        method2();
    }
});

benchs.generateCharts();

The charts will be generated in the specified folder.

Sub chart

If in the first graph, there are some methods that take a lot more time than the others. A sub chart will be generated including only the best methods. The methods to be removed from the graph to create the sub graph are selected using an exclusion factor. All the benchmarks with mean exclusionFactor times higher than another benchmark mean will be excluded. You can configure the exclusion factor using the setExclusionFactor setter. The default is 50.

You can download it here : benchmark-utils.tar.gz

You can consult the GitHub website for more informations and to get the source

From http://www.baptiste-wicht.com/2010/08/generate-graphs-benchmarks-easily

Build vs Buy a Data Quality Solution: Which is Best for You? Maintaining high quality data is essential for operational efficiency, meaningful analytics and good long-term customer relationships. But, when dealing with multiple sources of data, data quality becomes complex, so you need to know when you should build a custom data quality tools effort over canned solutions. Download our whitepaper for more insights into a hybrid approach.

Topics:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}