#include <string.h>
#include <sys/time.h>
#include <stdlib.h>
#include "../../sr_module.h"
#include "../../mi/mi.h"
#include "../../mem/mem.h"
#include "../../ut.h"
#include "benchmark.h"
#include "../../mem/shm_mem.h"

Go to the source code of this file.
Data Structures | |
| struct | bm_cfg |
Defines | |
| #define | _GNU_SOURCE |
Typedefs | |
| typedef struct bm_cfg | bm_cfg_t |
Functions | |
| int | _bm_log_timer (unsigned int id) |
| log_timer() | |
| int | _bm_register_timer (char *tname, int mode, unsigned int *id) |
| int | _bm_start_timer (unsigned int id) |
| start_timer() | |
| static int | bm_get_time_diff (struct sip_msg *msg, pv_param_t *param, pv_value_t *res) |
| PV get function for time diff. | |
| int | bm_log_timer (struct sip_msg *_msg, char *timer, char *mystr) |
| void | bm_reset_timer (int i) |
| MODULE_VERSION int | bm_start_timer (struct sip_msg *_msg, char *timer, char *foobar) |
| static void | destroy (void) |
| static int | fixup_bm_timer (void **param, int param_no) |
| int | load_bm (struct bm_binds *bmb) |
| API Binding. | |
| static int | mod_init (void) |
| static char * | pkg_strndup (char *_p, int _len) |
| void | reset_timers (void) |
| int | timer_active (unsigned int id) |
| timer_active(). | |
TimerMIfunctions MI functions | |
| struct mi_root * | mi_bm_enable_global (struct mi_root *cmd, void *param) |
| Expects 1 node: 0 for disable, 1 for enable. | |
| struct mi_root * | mi_bm_enable_timer (struct mi_root *cmd, void *param) |
| struct mi_root * | mi_bm_granularity (struct mi_root *cmd, void *param) |
| struct mi_root * | mi_bm_loglevel (struct mi_root *cmd, void *param) |
Variables | |
| static int | _bm_last_time_diff = 0 |
| static int | bm_enable_global = 0 |
| static int | bm_granularity = 1 |
| static int | bm_loglevel = L_INFO |
| bm_cfg_t * | bm_mycfg = 0 |
| static cmd_export_t | cmds [] |
| struct module_exports | exports |
| static mi_export_t | mi_cmds [] |
| static pv_export_t | mod_items [] |
| static param_export_t | params [] |
Definition in file benchmark.c.
| #define _GNU_SOURCE |
Definition at line 43 of file benchmark.c.
| int _bm_log_timer | ( | unsigned int | id | ) |
log_timer()
Definition at line 288 of file benchmark.c.
References _bm_last_time_diff, bm_diff_time(), bm_get_time(), benchmark_timer::calls, benchmark_timer::global_max, benchmark_timer::global_min, bm_cfg::granularity, benchmark_timer::last_max, benchmark_timer::last_min, benchmark_timer::last_sum, LM_ERR, LM_GEN1, bm_cfg::loglevel, benchmark_timer::name, benchmark_timer::start, benchmark_timer::sum, timer_active(), and bm_cfg::tindex.
Referenced by bm_log_timer(), and load_bm().
| int _bm_register_timer | ( | char * | tname, | |
| int | mode, | |||
| unsigned int * | id | |||
| ) |
Definition at line 360 of file benchmark.c.
References BM_NAME_LEN, bm_reset_timer(), benchmark_timer::id, LM_DBG, LM_ERR, benchmark_timer::name, benchmark_timer::next, bm_cfg::nrtimers, NULL, pkg_malloc, shm_free, shm_malloc(), benchmark_timer::start, bm_cfg::timers, and bm_cfg::tindex.
Referenced by fixup_bm_timer(), load_bm(), and mi_bm_enable_timer().
| int _bm_start_timer | ( | unsigned int | id | ) |
start_timer()
Definition at line 264 of file benchmark.c.
References bm_get_time(), LM_ERR, benchmark_timer::start, timer_active(), and bm_cfg::tindex.
Referenced by bm_start_timer(), and load_bm().
| static int bm_get_time_diff | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res | |||
| ) | [static] |
PV get function for time diff.
Definition at line 604 of file benchmark.c.
References _bm_last_time_diff, NULL, and pv_get_sintval().
| int bm_log_timer | ( | struct sip_msg * | _msg, | |
| char * | timer, | |||
| char * | mystr | |||
| ) |
| void bm_reset_timer | ( | int | i | ) |
Definition at line 219 of file benchmark.c.
References benchmark_timer::calls, benchmark_timer::global_max, benchmark_timer::global_min, benchmark_timer::last_max, benchmark_timer::last_min, benchmark_timer::last_sum, NULL, benchmark_timer::sum, and bm_cfg::tindex.
Referenced by _bm_register_timer(), and reset_timers().
| int bm_start_timer | ( | struct sip_msg * | _msg, | |
| char * | timer, | |||
| char * | foobar | |||
| ) |
| static void destroy | ( | void | ) | [static] |
Definition at line 199 of file benchmark.c.
References benchmark_timer::next, NULL, shm_free, bm_cfg::timers, and bm_cfg::tindex.
| static int fixup_bm_timer | ( | void ** | param, | |
| int | param_no | |||
| ) | [inline, static] |
Definition at line 613 of file benchmark.c.
References _bm_register_timer(), E_UNSPEC, LM_ERR, and pkg_free.
| int load_bm | ( | struct bm_binds * | bmb | ) |
API Binding.
Definition at line 443 of file benchmark.c.
References _bm_log_timer(), _bm_register_timer(), _bm_start_timer(), bm_binds::bm_log, bm_binds::bm_register, bm_binds::bm_start, and NULL.
Referenced by load_bm_api().
Expects 1 node: 0 for disable, 1 for enable.
Definition at line 475 of file benchmark.c.
References bm_cfg::enable_global, init_mi_tree(), mi_node::kids, _str::len, MI_BAD_PARM_LEN, MI_BAD_PARM_S, MI_MISSING_PARM_LEN, MI_MISSING_PARM_S, MI_OK_LEN, MI_OK_S, mi_node::next, mi_root::node, NULL, pkg_free, pkg_strndup(), _str::s, and mi_node::value.
Definition at line 507 of file benchmark.c.
References _bm_register_timer(), benchmark_timer::enabled, id, init_mi_tree(), mi_node::kids, _str::len, MI_BAD_PARM_LEN, MI_BAD_PARM_S, MI_MISSING_PARM_LEN, MI_MISSING_PARM_S, MI_OK_LEN, MI_OK_S, mi_node::next, mi_root::node, NULL, pkg_free, pkg_strndup(), _str::s, bm_cfg::timers, and mi_node::value.
Definition at line 544 of file benchmark.c.
References bm_cfg::granularity, init_mi_tree(), mi_node::kids, _str::len, MI_BAD_PARM_LEN, MI_BAD_PARM_S, MI_MISSING_PARM_LEN, MI_MISSING_PARM_S, MI_OK_LEN, MI_OK_S, mi_node::next, mi_root::node, NULL, pkg_free, pkg_strndup(), _str::s, and mi_node::value.
Definition at line 573 of file benchmark.c.
References bm_cfg::enable_global, init_mi_tree(), mi_node::kids, _str::len, MI_BAD_PARM_LEN, MI_BAD_PARM_S, MI_MISSING_PARM_LEN, MI_MISSING_PARM_S, MI_OK_LEN, MI_OK_S, mi_node::next, mi_root::node, NULL, pkg_free, pkg_strndup(), _str::s, and mi_node::value.
| static int mod_init | ( | void | ) | [static] |
Definition at line 184 of file benchmark.c.
References bm_enable_global, bm_granularity, bm_loglevel, bm_cfg::enable_global, bm_cfg::granularity, bm_cfg::loglevel, and shm_malloc().
| static char* pkg_strndup | ( | char * | _p, | |
| int | _len | |||
| ) | [inline, static] |
Definition at line 456 of file benchmark.c.
References NULL, pkg_malloc, and s.
Referenced by mi_bm_enable_global(), mi_bm_enable_timer(), mi_bm_granularity(), and mi_bm_loglevel().
| void reset_timers | ( | void | ) |
Definition at line 232 of file benchmark.c.
References bm_reset_timer(), bm_cfg::nrtimers, and NULL.
| int timer_active | ( | unsigned int | id | ) | [inline] |
Global enable mode can be: -1 - All timing disabled 0 - Timing enabled, watch for single timers enabled (default: off) 1 - Timing enabled for all timers
Definition at line 251 of file benchmark.c.
References bm_cfg::enable_global, benchmark_timer::enabled, and bm_cfg::timers.
Referenced by _bm_log_timer(), and _bm_start_timer().
int _bm_last_time_diff = 0 [static] |
int bm_enable_global = 0 [static] |
int bm_granularity = 1 [static] |
int bm_loglevel = L_INFO [static] |
Definition at line 105 of file benchmark.c.
cmd_export_t cmds[] [static] |
Definition at line 112 of file benchmark.c.
| struct module_exports exports |
Definition at line 161 of file benchmark.c.
mi_export_t mi_cmds[] [static] |
Definition at line 141 of file benchmark.c.
pv_export_t mod_items[] [static] |
Initial value:
{
{ {"BM_time_diff", sizeof("BM_time_diff")-1}, PVT_OTHER, bm_get_time_diff, 0,
0, 0, 0, 0 },
{ {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
}
Definition at line 152 of file benchmark.c.
param_export_t params[] [static] |
Definition at line 125 of file benchmark.c.
1.5.6