[][src]Trait opencv::core::TickMeterTrait

pub trait TickMeterTrait {
    fn as_raw_TickMeter(&self) -> *mut c_void;

    fn start(&mut self) -> Result<()> { ... }
fn stop(&mut self) -> Result<()> { ... }
fn get_time_ticks(&self) -> Result<i64> { ... }
fn get_time_micro(&self) -> Result<f64> { ... }
fn get_time_milli(&self) -> Result<f64> { ... }
fn get_time_sec(&self) -> Result<f64> { ... }
fn get_counter(&self) -> Result<i64> { ... }
fn reset(&mut self) -> Result<()> { ... } }

a Class to measure passing time.

The class computes passing time by counting the number of ticks per second. That is, the following code computes the execution time in seconds:

This example is not tested
TickMeter tm;
tm.start();
// do something ...
tm.stop();
std::cout << tm.getTimeSec();

It is also possible to compute the average time over multiple runs:

This example is not tested
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 also

getTickCount, getTickFrequency

Required methods

Loading content...

Provided methods

fn start(&mut self) -> Result<()>

starts counting ticks.

fn stop(&mut self) -> Result<()>

stops counting ticks.

fn get_time_ticks(&self) -> Result<i64>

returns counted ticks.

fn get_time_micro(&self) -> Result<f64>

returns passed time in microseconds.

fn get_time_milli(&self) -> Result<f64>

returns passed time in milliseconds.

fn get_time_sec(&self) -> Result<f64>

returns passed time in seconds.

fn get_counter(&self) -> Result<i64>

returns internal counter value.

fn reset(&mut self) -> Result<()>

resets internal values.

Loading content...

Implementors

impl TickMeterTrait for TickMeter[src]

Loading content...