FCF 2.0 development in progress...
> > > > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

begin() method from fcf::NTest::Duration class

void begin()

Class: fcf::NTest::Duration

Package: fcfTest

File: test.hpp

Available from version: 1.0.1

Records the current timestamp using a high-resolution clock to mark the start of a timing interval

The begin() method captures the current time point from std::chrono::high_resolution_clock. This method is used to initialize the measurement interval when performing manual timing of code blocks.

Example:

Use begin() and end() to wrap a specific section of code for precise measurement

fcf::NTest::Duration bench(1000000); // Start measurement bench.begin(); // Code to be measured for(int i = 0; i < bench.iterations(); ++i) { // Workload } // Stop measurement bench.end(); fcf::NTest::log() << "Total time: " << bench.totalDuration().count() << " ns" << std::endl;