end() method from fcf::NTest::DurationBasic class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.5
Ends a measurement session at a specific level.
The
It supports multiple signatures:
- Single Level: Ends the measurement for a single level index.
- Level Range: Ends measurements for all levels from a_beginLevel up to (but not including) a_endLevel.
Arguments
- The starting level index for ending the measurement.
- The ending level index (exclusive).
Example: Ending a Measurement
Demonstrating how to end a measurement session.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <thread>
#include <chrono>
FCF_TEST_DEFINE ("Bench", "Level", "BeginTest") {
fcf::NTest::Duration bench(100);
// Start measurement at level 0
bench.begin (0);
// Perform work
std::this_thread::sleep_for(std::chrono::seconds(1));
bench.end (0);
fcf::NTest::log () << "Measurement finished." << std::endl;
fcf::NTest::log () << " Duration: " << bench.duration (0) << 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" -> "Level" -> "BeginTest" ...
> Measurement finished.
> Duration: 1.000090518
[SUCCESS] Test completed successfully (1.000`143`731 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 1.000`143`731 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.