Summary

Class for computing wall-clock times.

Syntax

class tick_count;

Header

#include "tbb/tick_count.h"

Description

A tick_count is an absolute timestamp. Two tick_count objects may be subtracted to compute a relative time tick_count::interval_t , which can be converted to seconds.

Note

On Linux* OS, you may need to add -lrt to the linker command when you use tbb::tick_count class.

Example

using namespace tbb;

void Foo() {
    tick_count t0 = tick_count::now();
    ...action being timed...
    tick_count t1 = tick_count::now();
    printf("time for action = %g seconds\n", (t1-t0).seconds() );
}
      

Members

namespace tbb {

    class tick_count {
    public:
        class interval_t;
        static tick_count now();
        static double resolution();
    };

    tick_count::interval_t  operator-( const tick_count&  t1, const tick_count& t0 );
} // tbb
      
Para obter informações mais completas sobre otimizações do compilador, consulte nosso aviso de otimização.