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

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

unsigned long long iterations()

Class: fcf::NTest::Duration

Package: fcfTest

File: test.hpp

Available from version: 1.0.1

Returns the number of iterations configured for the current benchmarking session

The iterations() method returns the total count of execution cycles defined during the instantiation of the fcf::NTest::Duration object. This value is used to control manual loops or to provide context for timing results.

Result
unsigned long long
- returns the number of specified iterations in the object.

Example:

When using manual timing with begin() and end(), use iterations() to ensure the loop runs exactly the intended number of times

fcf::NTest::Duration bench(5000); bench.begin(); for(unsigned long long i = 0; i < bench.iterations(); ++i) { // Target code int x = i * i; } bench.end(); fcf::NTest::log() << "Iterations: " << bench.iterations() << std::endl; fcf::NTest::log() << "Avg duration: " << bench.duration().count() << " ns" << std::endl;