public class PerformanceCounter extends Object
start()
just before
starting the task and stop()
right after. You can do this multiple times if required. Every render or update call
tick()
to update the values. The time
FloatCounter
provides access to the minimum, maximum, average,
total and current time (in seconds) the task takes. Likewise for the load
value, which is the percentage of the total time.Modifier and Type | Field and Description |
---|---|
float |
current
The current value in seconds, you can manually increase this using your own timing mechanism if needed, if you do so, you also need to
update
valid . |
FloatCounter |
load
The load value of this counter
|
String |
name
The name of this counter
|
FloatCounter |
time
The time value of this counter (seconds)
|
boolean |
valid
Flag to indicate that the current value is valid, you need to set this to true if using your own timing mechanism
|
Constructor and Description |
---|
PerformanceCounter(String name) |
PerformanceCounter(String name,
int windowSize) |
Modifier and Type | Method and Description |
---|---|
void |
reset()
Resets this performance counter to its defaults values.
|
void |
start()
Start counting, call this method just before performing the task you want to keep track of.
|
void |
stop()
Stop counting, call this method right after you performed the task you want to keep track of.
|
void |
tick()
Updates the time and load counters and resets the time.
|
void |
tick(float delta)
Updates the time and load counters and resets the time.
|
String |
toString() |
StringBuilder |
toString(StringBuilder sb)
Creates a string in the form of "name [time: value, load: value]"
|
public final FloatCounter time
public final FloatCounter load
public final String name
public float current
valid
.public boolean valid
public PerformanceCounter(String name)
public PerformanceCounter(String name, int windowSize)
public void tick()
start()
to begin a new count. The values are only
valid after at least two calls to this method.public void tick(float delta)
start()
to begin a new count.delta
- The time since the last call to this methodpublic void start()
stop()
when done.public void stop()
start()
again
when you perform more of that task.public void reset()
public StringBuilder toString(StringBuilder sb)
Copyright © 2017. All rights reserved.