public class TickMeter extends Object
TickMeter tm;
tm.start();
// do something ...
tm.stop();
std::cout << tm.getTimeSec();
It is also possible to compute the average time over multiple runs:
TickMeter tm;
for (int i = 0; i < 100; i++)
{
tm.start();
// do something ...
tm.stop();
}
double average_time = tm.getTimeSec() / tm.getCounter();
std::cout << "Average time in second per iteration is: " << average_time << std::endl;
SEE: getTickCount, getTickFrequencyModifier and Type | Field and Description |
---|---|
protected long |
nativeObj |
Modifier | Constructor and Description |
---|---|
|
TickMeter() |
protected |
TickMeter(long addr) |
Modifier and Type | Method and Description |
---|---|
static TickMeter |
__fromPtr__(long addr) |
protected void |
finalize() |
long |
getCounter()
returns internal counter value.
|
long |
getNativeObjAddr() |
double |
getTimeMicro()
returns passed time in microseconds.
|
double |
getTimeMilli()
returns passed time in milliseconds.
|
double |
getTimeSec()
returns passed time in seconds.
|
long |
getTimeTicks()
returns counted ticks.
|
void |
reset()
resets internal values.
|
void |
start()
starts counting ticks.
|
void |
stop()
stops counting ticks.
|
public long getNativeObjAddr()
public static TickMeter __fromPtr__(long addr)
public double getTimeMicro()
public double getTimeMilli()
public double getTimeSec()
public long getCounter()
public long getTimeTicks()
public void reset()
public void start()
public void stop()
Copyright © 2020. All rights reserved.