max() method from fcf::NTest::DurationBasic class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.5
Returns the maximum duration recorded for a specific level.
The
Arguments
- The index of the measurement level.
Result
- The maximum duration recorded for the specified level.
Example: Retrieving Maximum Duration
Getting the maximum time recorded.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <thread>
#include <chrono>
FCF_TEST_DEFINE ("Bench", "Stats", "MaxTest") {
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 maxVal = bench.max (0);
fcf::NTest::log () << "Max duration: " << maxVal << 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" -> "MaxTest" ...
> Max duration: 3.000130904
[SUCCESS] Test completed successfully (6.000`482`336 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 6.000`482`336 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.