histogram() method from fcf::NTest::DurationBasic class
const fcf::NTest::HistogramBasic <fcf::NTest::TimeDuration , unsigned long long >&
histogram (size_t a_level = 0) const
Class:
Package: fcfTest
File: test.hpp ( link_to_the_declaration_in_the_file , link_to_the_implementation_in_the_file )
Available from version: 1.2.5
Provides access to the histogram of the measurement distribution.
The
Arguments
- The index of the measurement level.
Result
- A reference to the histogram for the specified level.
Example: Accessing the Histogram
Demonstrating how to retrieve the histogram to perform statistical analysis.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <thread>
#include <chrono>
FCF_TEST_DEFINE ("Bench", "Stats", "MedianTest") {
fcf::NTest::Duration bench(100);
bench ([](){
std::this_thread::sleep_for(std::chrono::milliseconds(1));
});
fcf::NTest::log () << "Histogram:" << std::endl;
fcf::NTest::log () << bench.histogram (0).toBarChart () << std::endl;
fcf::NTest::log () << "Table:" << std::endl;
fcf::NTest::log () << bench.histogram (0).toTable () << 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" -> "MedianTest" ...
> Histogram:
> |
> |
> |
> |
> |
> | |
> | |
> |||||
> |||||||||
> |||||||||
> ══════════
> OX (value): [0.001`058`366 : 0.001`145`743]; Step: 8737.70
> OY (count): [2 : 29]; Step: 2.70
>
> Table:
> ╔════╦═════════════════════════════════╦═══════╗
> ║ # ║ values ║ count ║
> ╠════╬═════════════════════════════════╬═══════╣
> ║ 1 ║ [0.001`058`366 : 0.001`067`102] ║ 6 ║
> ║ 2 ║ [0.001`067`103 : 0.001`075`840] ║ 29 ║
> ║ 3 ║ [0.001`075`841 : 0.001`084`578] ║ 10 ║
> ║ 4 ║ [0.001`084`579 : 0.001`093`316] ║ 13 ║
> ║ 5 ║ [0.001`093`317 : 0.001`102`054] ║ 10 ║
> ║ 6 ║ [0.001`102`055 : 0.001`110`791] ║ 10 ║
> ║ 7 ║ [0.001`110`792 : 0.001`119`529] ║ 6 ║
> ║ 8 ║ [0.001`119`530 : 0.001`128`267] ║ 7 ║
> ║ 9 ║ [0.001`128`268 : 0.001`137`005] ║ 7 ║
> ║ 10 ║ [0.001`137`006 : 0.001`145`743] ║ 2 ║
> ╚════╩═════════════════════════════════╩═══════╝
>
[SUCCESS] Test completed successfully (0.109`598`564 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.109`598`564 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.