Giter Club home page Giter Club logo

caliper's Introduction

Caliper is Google's open-source framework for writing, running and viewing the results of JavaMicrobenchmarks.

The latest release is 1.0-beta-1. It can be downloaded as a single uberjar or referenced as a maven dependency:

    <dependency>
      <groupId>com.google.caliper</groupId>
      <artifactId>caliper</artifactId>
      <version>1.0-beta-1</version>
    </dependency>

Getting Started

The simplest complete Caliper benchmark looks like this:

    public class MyBenchmark extends Benchmark {
      public void timeMyOperation(int reps) {
        for (int i = 0; i < reps; i++) {
            MyClass.myOperation();
        }
      }
    }

See the examples in examples/src/main/java/examples, notably:

  • DemoBenchmark.java -- an annotated example
  • NoOpBenchmark.java -- ze goggles, zey do nussing! The absolute minimal benchmark, does nothing but time the rep loop.
  • MessageDigestCreationBenchmark -- runs with several parameters
  • ArraySortBenchmark.java -- example of assembling complex input before running

Build

  1. Get a local copy of the caliper repository with this command:

     git clone https://code.google.com/p/caliper/
    

    cd caliper

  2. To build this project with Maven:

     cd caliper
     mvn eclipse:configure-workspace eclipse:eclipse install
    
  3. To build examples:

     cd examples
     mvn eclipse:configure-workspace eclipse:eclipse install
    

Usage

Run the included 'caliper' script, passing in classnames to benchmark:

    cd examples
    ../script/caliper examples.ArraySortBenchmark examples.DemoBenchmark.java

Or use maven directly; set 'exec.args' to the classname to benchmark

    cd examples
    mvn compile exec:java -Dexec.mainClass=com.google.caliper.runner.CaliperMain -Dexec.args=examples.ArraySortBenchmark

License

Apache License Version 2.0, January 2004 -- see the file COPYING in this directory

caliper's People

Contributors

cgruber avatar gk5885 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ludwsam

caliper's Issues

Worker VM initialization fails with TieredCompilation enabled on JRE8

I tried running some benchmarks on Java 8 and got an error "CICompilerCount of 1 is invalid; must be at least 2"

As far as I know, TieredCompilation was introduced in Java 7 but not enabled by default. It seems to be enabled by default for Java 8, so both the client and server compilers need their own threads.

Simply disabling it with -XX:-TieredCompliation does the trick, but I was wondering if this could be addressed in the caliper codebase.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.