benchmark.c File Reference

Benchmark :: Module Core. More...

#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"

Include dependency graph for benchmark.c:

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_rootmi_bm_enable_global (struct mi_root *cmd, void *param)
 Expects 1 node: 0 for disable, 1 for enable.
struct mi_rootmi_bm_enable_timer (struct mi_root *cmd, void *param)
struct mi_rootmi_bm_granularity (struct mi_root *cmd, void *param)
struct mi_rootmi_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_tbm_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 []


Detailed Description

Benchmark :: Module Core.

Definition in file benchmark.c.


Define Documentation

#define _GNU_SOURCE

Definition at line 43 of file benchmark.c.


Typedef Documentation

typedef struct bm_cfg bm_cfg_t


Function Documentation

int _bm_log_timer ( unsigned int  id  ) 

int _bm_register_timer ( char *  tname,
int  mode,
unsigned int *  id 
)

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 
)

Definition at line 355 of file benchmark.c.

References _bm_log_timer().

void bm_reset_timer ( int  i  ) 

int bm_start_timer ( struct sip_msg _msg,
char *  timer,
char *  foobar 
)

Definition at line 278 of file benchmark.c.

References _bm_start_timer().

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  ) 

struct mi_root * mi_bm_enable_global ( struct mi_root cmd,
void *  param 
) [read]

struct mi_root * mi_bm_enable_timer ( struct mi_root cmd,
void *  param 
) [read]

struct mi_root * mi_bm_granularity ( struct mi_root cmd,
void *  param 
) [read]

struct mi_root * mi_bm_loglevel ( struct mi_root cmd,
void *  param 
) [read]

static int mod_init ( void   )  [static]

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]

timer_active().

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().


Variable Documentation

int _bm_last_time_diff = 0 [static]

Definition at line 84 of file benchmark.c.

Referenced by _bm_log_timer(), and bm_get_time_diff().

int bm_enable_global = 0 [static]

Definition at line 80 of file benchmark.c.

Referenced by mod_init().

int bm_granularity = 1 [static]

Definition at line 81 of file benchmark.c.

Referenced by mod_init().

int bm_loglevel = L_INFO [static]

Definition at line 82 of file benchmark.c.

Referenced by mod_init().

Definition at line 105 of file benchmark.c.

cmd_export_t cmds[] [static]

Definition at line 112 of file benchmark.c.

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.


Generated on Thu May 17 12:00:36 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6