Manak  2.0.0
Simple Benchmark Module

Introduction

This module is useful when the library name is constant for all the cases registered in the scope. This module can be set by defining 'MANAK_SIMPLE_MODULE' to appropriate module name. After this definition the default library or constant library name is taken as the module name. To change the name define 'MANAK_BASE_LIBRARY_NAME' to desired value.

Auto Registration

For detalied information on auto registration of benchmark cases and benchmark suites in simple module see Auto Registration With Simple Module.

The macros provided for auto registartion of benchmark case:

Macro to register manually generated functions as cases:

The macros provided for auto registration of benchmark suite:

The macros provided for auto registration of parametrized benchmark:

The macros provided for auto registration of groups:

The macros provided for auto registration of group benchmark cases:

The macros provided for auto registation of group parametrized benchmark case:

Example

#define MANAK_SIMPLE_MODULE bench
#define MANAK_AUTO_MAIN
#define MANAK_INIT
#define MANAK_BASE_LIBRARY_NAME Lib1
#include <manak/manak.hpp>
{
(
for(size_t i = 0;i < 1000;i++);
)
}
{
(
for(size_t i = 0;i < 10000;i++);
)
}
void fun3(size_t a)
{
(
for(size_t i = 0;i < a;i++);
)
}
MANAK_ADD_CASE(MANAK_CREATE_BENCHMARK_WITH_TEMPLATE(B3, fun3)->AddArgs(2000)->AddArgs(3000));
size_t iter;
{
iter = 1000;
}
{
(
for(size_t i = 0;i < iter;i++);
)
}
void fun(size_t a)
{
}
MANAK_ADD_TO_GROUP(MANAK_CREATE_GROUP_BENCHMARK_WITH_TEMPLATE("InGroup2", fun)->AddArgs(100)->AddArgs(200));
MANAK_ADD_TO_GROUP(MANAK_CREATE_BENCHMARK_WITH_TEMPLATE(InGroup3, fun3)->AddArgs(100)->AddArgs(200));

Note: To register the function inside the group as parametrized benchmark use 'MANAK_CREATE_GROUP_BENCHMARK_WITH_TEMPLATE'. To register the function outside the group as parametrized benchmark use 'MANAK_CREATE_BENCHMARK_WITH_TEMPLATE'. See registration of cases 'InGroup2' and 'InGroup3' for examples.

Output -

HTML output can be seen HERE

The equivalent manual registration code can be found at Example.

Manual Registration

For detailed information on manual registration of benchmark cases and benchmark suites in simple benchmark module see Manual Registartion with Simple Module.

The macros provided for manual registartion of benchmark case:

The macros provided for manual registration of benchmark suite:

The macros provided for manual regstration of parametrized benchmark cases:

The macros provided for manual registration of groups:

The macros provided for manual registration of group benchmark cases:

The macros provided for manual registration of group parametrized benchmark cases:

Example

bool bench_init();
#define MANAK_SIMPLE_MODULE bench
#define MANAK_AUTO_MAIN
#define MANAK_INIT
#define MANAK_BASE_LIBRARY_NAME Lib1
#define MANAK_MANUAL_INIT_FUNCTION bench_init
#include <manak/manak.hpp>
using namespace manak;
using namespace std;
void fun1()
{
(
for(size_t i = 0;i < 1000;i++);
)
}
void fun2()
{
(
for(size_t i = 0;i < 10000;i++);
)
}
void fun3(size_t a)
{
(
for(size_t i = 0;i < a;i++);
)
}
MANAK_GROUP(TestGroup);
size_t iter;
{
iter = 1000;
cases.push_back(MANAK_GROUP_BENCHMARK_CASE("InGroup", fun1));
cases.push_back(MANAK_CREATE_GROUP_BENCHMARK_WITH_TEMPLATE("InGroup2", fun)->AddArgs(100)->AddArgs(200));
cases.push_back(MANAK_CREATE_BENCHMARK_WITH_TEMPLATE(InGroup3, fun3)->AddArgs(100)->AddArgs(200));
}
void fun1()
{
(
for(size_t i = 0;i < iter;i++);
)
}
void fun(size_t a)
{
}
bool bench_init()
{
master_suite.AddCase(MANAK_BENCHMARK_CASE_I(B1, fun1, 10));
ManakSuite* Suite1 = master_suite.AddSuite(MANAK_SUITE(Suite1));
Suite1->AddCase(MANAK_BENCHMARK_CASE_T(B2, fun2, 50));
master_suite.AddCase(MANAK_CREATE_BENCHMARK_WITH_TEMPLATE(B3, fun3)->AddArgs(2000)->AddArgs(3000));
master_suite.AddGroup<MG_TestGroup>();
}

Ouput -

HTML output can be seen HERE

The equivalent auto registration code can be found at Example.

Comparison Framework

Check out Comparison Framework for Simple Module for information on comparion framework of simple module.