%docentities; ]> &develguide; The benchmark module provides an internal API to be used by other &kamailio; modules. The available functions are identical to the user exported functions. Please note that this module is intended mainly for developers. It should be used with caution in production environments.
Available Functions
<function moreinfo="none">bm_register(name, mode, id)</function> This function register a new timer and/or returns the internal ID associated with the timer. mode controls the creation of new timer if not found. id is to be used by start and log timer functions.
<function moreinfo="none">bm_start(id)</function> This function equals the user-exported function bm_start_timer. The id is passed as an integer, though.
<function moreinfo="none">bm_log(id)</function> This function equals the user-exported function bm_log_timer. The id is passed as an integer, though.
Benchmark API Example Using the benchmark module's API from another module ... #include "../benchmark/benchmark.h" ... struct bm_binds bmb; ... ... /* load the benchmarking API */ if (load_bm_api( &bmb )!=0) { LM_ERR("can't load benchmark API\n"); goto error; } ... ... /* Start/log timers during a (usually user-exported) module function */ bmp.bm_register("test", 1, &id) bmb.bm_start(id); do_something(); bmb.bm_log(id); ...