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

min() method from fcf::NTest::DurationBasic class

fcf::NTest::TimeDuration min(int a_level = 0) const

Class: fcf::NTest::DurationBasic

Package: fcfTest

File: test.hpp

Available from version: 1.2.5

Returns the minimum duration recorded for a specific level.

The min method returns the smallest duration value recorded during the measurement session at the specified level.

Arguments

int a_level = 0
- The index of the measurement level.
Result
fcf::NTest::TimeDuration
- The minimum duration recorded for the specified level.

Example: Retrieving Minimum Duration

Getting the minimum time recorded.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> #include <thread> #include <chrono> FCF_TEST_DEFINE("Bench", "Stats", "MinTest") { fcf::NTest::Duration bench; bench.begin(); std::this_thread::sleep_for(std::chrono::seconds(1)); bench.end(); bench.begin(); std::this_thread::sleep_for(std::chrono::seconds(2)); bench.end(); bench.begin(); std::this_thread::sleep_for(std::chrono::seconds(3)); bench.end(); fcf::NTest::TimeDuration minVal = bench.min(0); fcf::NTest::log() << "Min duration: " << minVal << std::endl; } int main(int a_argc, char* a_argv[]) { bool error = false; fcf::NTest::cmdRun(a_argc, a_argv, fcf::NTest::CRM_RUN, &error); return error ? 1 : 0; }

Output:

Performing the test: "Bench" -> "Stats" -> "MinTest" ... > Min duration: 1.000152237 [SUCCESS] Test completed successfully (6.000`464`021 sec) [SUCCESS] All tests were completed. Tests: 1 passed, 0 failed, 0 skipped, 1 total Duration: 6.000`464`021 sec