Manak  2.0.0
Normal Module

Introduction

This module is useful when cases are need to be registered with different library names.

Auto Registration

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

The macros provided for auto registartion of benchmark case:

The macros provided for auto registration of benchmark suite:

The macros provided for auto registration of parametrized benchmark cases:

The macros provided for auto registration of groups:

The macros provided for auto registration of group benchmark cases:

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

Example

#define MANAK_MODULE bench
#define MANAK_AUTO_MAIN
#define MANAK_INIT
#include <manak/manak.hpp>
void fun3(size_t a)
{
(
for(size_t i = 0;i < a;i++);
)
}
{
(
for(size_t i = 0;i < 1000;i++);
)
}
{
(
for(size_t i = 0;i < 1000;i++);
)
}
{
(
for(size_t i = 0;i < 10000;i++);
)
}
{
(
for(size_t i = 0;i < 10000;i++);
)
}
MANAK_ADD_CASE(MANAK_CREATE_BENCHMARK_WITH_TEMPLATE_I(B3, lib1, fun3, 10)->AddArgs((size_t)2000)->AddArgs((size_t)3000));
MANAK_ADD_CASE(MANAK_CREATE_BENCHMARK_WITH_TEMPLATE_T(B3, lib2, fun3, 50)->AddArgs((size_t)4000)->AddArgs((size_t)6000));
size_t iter;
{
iter = 100;
}
{
(
for(size_t i = 0;i < iter;i++);
)
}
MANAK_AUTO_GROUP_BENCHMARK_CASE_I("InGroup1", "Lib2", 10)
{
(
for(size_t i = 0;i < 10 * iter;i++);
)
}
void fun1(size_t a)
{
(
for(size_t i = 0;i < a * iter;i++);
)
}
MANAK_ADD_TO_GROUP(MANAK_CREATE_GROUP_BENCHMARK_WITH_TEMPLATE_TI("InGroup2", "Lib1", fun1, 10, 50)->AddArgs(100)->AddArgs(1000));

Output -

HTML output can be seen HERE

The equivalent manual registration code can be found at Example.

Manual Registration with Normal Mode

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

The macros provided for manual registartion of benchmark case:

The macros provided for manual registration of benchmark suite:

The macros provided for manual registration 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_MODULE bench
#define MANAK_AUTO_MAIN
#define MANAK_INIT
#define MANAK_MANUAL_INIT_FUNCTION bench_init
#include <manak/manak.hpp>
using namespace std;
using namespace manak;
void fun3(size_t a)
{
(
for(size_t i = 0;i < a;i++);
)
}
void fun1()
{
(
for(size_t i = 0;i < 1000;i++);
)
}
void fun2()
{
(
for(size_t i = 0;i < 1000;i++);
)
}
void fun4()
{
(
for(size_t i = 0;i < 10000;i++);
)
}
void fun5()
{
(
for(size_t i = 0;i < 10000;i++);
)
}
MANAK_GROUP(TestGroup);
size_t iter;
{
iter = 100;
cases.push_back(MANAK_GROUP_BENCHMARK_CASE("InGroup1", "Lib1", fun2));
cases.push_back(MANAK_GROUP_BENCHMARK_CASE_I("InGroup1", "Lib2", fun3, 10));
cases.push_back(MANAK_CREATE_GROUP_BENCHMARK_WITH_TEMPLATE_TI("InGroup2", "Lib1", fun1, 10, 50)->AddArgs(100)->AddArgs(1000));
}
void fun2()
{
(
for(size_t i = 0;i < iter;i++);
)
}
void fun3()
{
(
for(size_t i = 0;i < 10 * iter;i++);
)
}
void fun1(size_t a)
{
(
for(size_t i = 0;i < a * iter;i++);
)
}
bool bench_init()
{
ManakSuite& master_suite = ManakSuite::GetMasterSuite();
master_suite.AddCase(MANAK_BENCHMARK_CASE_I(B1, lib1, fun1, 10));
master_suite.AddCase(MANAK_BENCHMARK_CASE_TI(B1, lib2, fun2, 10, 50));
ManakSuite* Suite1 = master_suite.AddSuite(MANAK_SUITE(Suite1));
Suite1->AddCase(MANAK_BENCHMARK_CASE_T(B2, lib1, fun4, 50));
Suite1->AddCase(MANAK_BENCHMARK_CASE_I(B2, lib2, fun5, 10));
ManakSuite* Suite2 = Suite1->AddSuite(MANAK_SUITE(Suite2));
Suite2->AddCase(MANAK_CREATE_BENCHMARK_WITH_TEMPLATE_I(B3, lib1, fun3, 10)->AddArgs((size_t)2000)->AddArgs((size_t)3000));
Suite2->AddCase(MANAK_CREATE_BENCHMARK_WITH_TEMPLATE_T(B3, lib2, fun3, 50)->AddArgs((size_t)4000)->AddArgs((size_t)6000));
master_suite.AddGroup<MG_TestGroup>();
return true;
}

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 normal module.