Skip to content

Benchmark

Using Benchmark SDK

WARNING

Before using the SDK you need to instantiate it using sdk_init::benchmark() - example provided on this page

Benchmarking

WARNING

Do not keep the benchmark in release builds
Benchmarking is only available to verified developers account

TIP

Preferably you want to add an #ifdef to remove benchmarking completely from release builds

There is a macro defined to add a new benchmark (BENCHMARK_ADD)

cpp
#define BENCHMARK

void __fastcall draw_world()
{
#ifdef BENCHMARK
    BENCHMARK_ADD( "awareness_draw_world" );

    benchmark->start();
#endif

    world::heroes::draw();
    world::towers::draw();
    world::traps::draw();

    for( auto& hero_info : awareness_heroes )
        spell_hud::draw( hero_info );

#ifdef BENCHMARK
    benchmark->stop();
#endif
}
#define BENCHMARK

void __fastcall draw_world()
{
#ifdef BENCHMARK
    BENCHMARK_ADD( "awareness_draw_world" );

    benchmark->start();
#endif

    world::heroes::draw();
    world::towers::draw();
    world::traps::draw();

    for( auto& hero_info : awareness_heroes )
        spell_hud::draw( hero_info );

#ifdef BENCHMARK
    benchmark->stop();
#endif
}