public class StepDouble extends Object implements StepValue
This class is an internal implementation detail only intended for use within spectator. It is subject to change without notice.
| Constructor and Description |
|---|
StepDouble(double init,
Clock clock,
long step)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
double |
addAndGet(long now,
double amount)
Increment the current value and return the result.
|
boolean |
compareAndSet(long now,
double expect,
double update)
Set the current value and return the previous value.
|
double |
getAndAdd(long now,
double amount)
Increment the current value and return the value before incrementing.
|
double |
getAndSet(long now,
double value)
Set the current value and return the previous value.
|
double |
getCurrent()
Get the value for the current bucket.
|
double |
getCurrent(long now)
Get the value for the current bucket.
|
void |
max(long now,
double value)
Set the current value to the maximum of the current value or the provided value.
|
void |
min(long now,
double value)
Set the current value to the minimum of the current value or the provided value.
|
double |
poll()
Get the value for the last completed interval.
|
double |
poll(long now)
Get the value for the last completed interval.
|
double |
pollAsRate()
Get the value for the last completed interval as a rate per second.
|
double |
pollAsRate(long now)
Get the value for the last completed interval as a rate per second.
|
void |
setCurrent(long now,
double value)
Set the value for the current bucket.
|
long |
timestamp()
Get the timestamp for the end of the last completed interval.
|
String |
toString() |
public StepDouble(double init,
Clock clock,
long step)
public double getCurrent()
public double getCurrent(long now)
public void setCurrent(long now,
double value)
public double addAndGet(long now,
double amount)
public double getAndAdd(long now,
double amount)
public double getAndSet(long now,
double value)
public boolean compareAndSet(long now,
double expect,
double update)
public void min(long now,
double value)
public void max(long now,
double value)
public double poll()
public double poll(long now)
public double pollAsRate()
pollAsRate in interface StepValuepublic double pollAsRate(long now)
pollAsRate in interface StepValuepublic long timestamp()