Need help with meter?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

125 Stars 7 Forks 184 Commits 2 Opened issues


Meter - is a simple micro-benchmarking tool for Android (and Java) projects. This is not a profiler, this is very small utility class that designed for making benchmarking easy. Nothing more. Alternative to Android Jetpack Benchmark.

Services available


Need anything else?

Contributors list

# 201,147
92 commits
# 541,162
37 commits


Build Status Coverage Status codecov.ioCoverity Scan Build Status

Download Android Arsenal Methods Count


Active development, started at: 2014-07-13

Current state: on hold. Collecting devs feedback.

What is meter?

Meter - is a simple micro-benchmarking tool for Android (not only for Android, its actually for any Java project).

It was designed for Android. Meter try to make measurement an easy task, with minimal impact on total project performance.

By using it you can easily benchmark critical components of own Android Projects and select the best possible way based on real measurments, instead of making gueses. It can be easily attached to jUnits and on each run will confirm performance choices.

Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.

(C) Donald Knuth -

Include Into Project

repositories {
    maven {
        url  ""

dependencies { // ALTERNATIVE: // compile(group: 'com.artfulbits', name: 'meter', version: '', ext: 'aar') compile 'com.artfulbits:meter:[email protected]' }

Changes Log


  • ADD: compare of tracked steps by Total value with custom accuracy
  • ADD: JAR binray generated for Maven repository. Hope it will resolve issues with library attaching to projects.

Changes Log

Advanced topics

Accuracy of Measurements


Custom Logs

Android Performance Results

Unit Testing


Output Preview

Meter Results Output

Design objectives

  • minimalistic code
  • deployment in one file
  • no support of scenarios that has more than 256 steps
  • nested measurements
  • measurement of loops/iterations:
  • loops with known number of iterations
  • loops with unknown number of iterations (round array in use, 1000 steps of loop used for average calculations)
  • loop Min/Max/Average cost of iteration
  • no sub-steps inside the loops, but allowed sub-measurement
  • measurement limited by one thread (partly limited by class design, its just a recommendation not an actual limit)
  • minimalistic allocations during benchmarking, all calculations and allocations are done only on Meter.stats() call
  • logcat as standard output. Developer can change output class instance to any required. Simple interface to inherit/implement.
  • simple configuration of output formats. Boolean flags mostly.
  • nanos timestamps used for time calculations, millis for time output
  • support Android native traceview benchmarking/profiling

Calls Protocol

Sample of typical micro benchmark:

  // ... create/get instance for tests ...
  final static Meter sMeter = Meter.getInstance();

public void test_00_mainProtocol() { // ... start the play! ... sMeter.start("test_00_mainProtocol");

// ... do some warm up steps ...
sMeter.skip("warm up of the classes");

// ... do some logic steps #1 ...
sMeter.beat("logic step execution #1 ");

// ... do some logic steps #2 ...
sMeter.beat("logic step execution #2");

sMeter.loop(100, "reserve space for 100 loops");
for( int i =0; i < 100; i++ ){

  // ... do some iteration logic ...

sMeter.finish("END of test_00_mainProtocol()");


Step 0 - Get Instance

All activities with micro-benchmarking should be started from call

- this is the entry point. You can choose would you want to keep reference in local variable or each time call the method. Inside the method implemented simplest cache-map
which keeps association of thread with Meter instance. In most cases you will need only one
instance per thread.
  final Meter mMeter = Meter.getInstance();

/** Get instance of the benchmark tool. */ public Meter meter() { return mMeter; }

Step 1 - Start and Finish

To start benchmarking you should call a corresponding method

and of course to finish the job call one proposed methods

- stops benchmarking, but does not remove results from 'stack'. That allows to do some manipulations and should be used for 'nested' measurements. After this call you should not forget to call

- stops benchmarking, removing 'measurement' from 'stack' and print results. This is recommended method to call at the end of benchmark.

Step 2 - Beats

Available two commands:

. First one create timestamp that participate in calculations of execution costs, second one excluding tracked step from calculations.

So we have ability to create complex scenarios with included and excluded steps.

Step 3 - Loops

In class exists three API methods for loops benchmarking:

. First two APIs defining the scope of the loop, third one - timestamp iteration inside the loop.
  • Loops can be nested.
  • If you call
    - than first parameter define the quantity of iterations to track. This allows to benchmark without mistakes of computations.
  • if you call
    - than class become prepared for loops with unknown number of iterations. Its a smart operation and if tracked number of iterations is less than 1000 (1 thousand) - we got computations without mistakes, otherwise will be always a small computation mistake.

That's it. Don't forget to call

for getting results in logcat.


Copyright 2015 Oleksandr Kucherenko
Copyright 2005-2015 ArtfulBits, Inc. (

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.