Class Counter

java.lang.Object
com.codename1.backend.metrics.Instrument
com.codename1.backend.metrics.Counter

public final class Counter extends Instrument

A count that only goes up -- requests served, jobs run, errors seen. Exported as a cumulative monotonic sum.

Recording is one atomic add: no lock, no allocation.

  • Method Details

    • increment

      public void increment()
      Adds one.
    • add

      public void add(long amount)
      Adds amount. A counter refuses a negative amount, since a cumulative monotonic sum that falls reads as a reset to every backend; an up-down counter takes either sign.
    • get

      public long get()
    • points

      public List points()
      Description copied from class: Instrument
      The current points, each a map with attributes (a map, possibly empty) and either value or, for a histogram, count, sum, min, max, bounds and buckets.
      Specified by:
      points in class Instrument