statistics.h File Reference

Kamailio statistics handling. More...

#include "hash_func.h"
#include "atomic.h"

Include dependency graph for statistics.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  module_stats_
struct  stat_export_
struct  stat_var_
struct  stats_collector_

Defines

#define destroy_stats_collector()
#define get_stat(_name)   0
#define get_stat_val(_var)   0
#define get_stat_var_from_num_code(_n_code, _in_code)   NULL
#define if_reset_stat(_c, _var)
#define if_update_stat(_c, _var, _n)
#define init_stats_collector()   0
#define NUM_IP_OCTETS   4
#define register_module_stats(_mod, _stats)   0
#define register_stat(_mod, _name, _pvar, _flags)   0
#define reset_stat(_var)
#define STAT_IS_FUNC   (1<<3)
#define STAT_NO_RESET   (1<<0)
#define STAT_NO_SYNC   (1<<1)
#define STAT_SHM_NAME   (1<<2)
#define STATS_HASH_POWER   8
#define STATS_HASH_SIZE   (1<<(STATS_HASH_POWER))
#define update_stat(_var, _n)

Typedefs

typedef struct module_stats_ module_stats
typedef struct stat_export_ stat_export_t
typedef unsigned long(* stat_function )(void)
typedef unsigned int stat_val
typedef struct stat_var_ stat_var
typedef struct stats_collector_ stats_collector

Functions

int get_socket_list_from_proto (int **ipList, int protocol)
int get_total_bytes_waiting (void)


Detailed Description

Kamailio statistics handling.

Definition in file statistics.h.


Define Documentation

 
#define destroy_stats_collector (  ) 

Definition at line 127 of file statistics.h.

Referenced by cleanup().

#define get_stat ( _name   )     0

Definition at line 130 of file statistics.h.

Referenced by fixup_stat(), get_statistic(), w_reset_stat(), and w_update_stat().

#define get_stat_val ( _var   )     0

Definition at line 131 of file statistics.h.

Referenced by get_number_of_users(), get_statistic(), and pv_get_dlg_count().

#define get_stat_var_from_num_code ( _n_code,
_in_code   )     NULL

#define if_reset_stat ( _c,
_var   ) 

Definition at line 196 of file statistics.h.

#define if_update_stat ( _c,
_var,
_n   ) 

 
#define init_stats_collector (  )     0

Definition at line 126 of file statistics.h.

Referenced by main().

#define NUM_IP_OCTETS   4

Definition at line 44 of file statistics.h.

Referenced by createIndex(), createRowsFromIPList(), and getRow().

#define register_module_stats ( _mod,
_stats   )     0

Definition at line 128 of file statistics.h.

Referenced by init_mod().

#define register_stat ( _mod,
_name,
_pvar,
_flags   )     0

#define reset_stat ( _var   ) 

Definition at line 194 of file statistics.h.

Referenced by w_reset_stat().

#define STAT_IS_FUNC   (1<<3)

Definition at line 49 of file statistics.h.

#define STAT_NO_RESET   (1<<0)

Definition at line 46 of file statistics.h.

Referenced by new_udomain(), and reg_statistic().

#define STAT_NO_SYNC   (1<<1)

Definition at line 47 of file statistics.h.

#define STAT_SHM_NAME   (1<<2)

Definition at line 48 of file statistics.h.

Referenced by new_udomain().

#define STATS_HASH_POWER   8

Definition at line 41 of file statistics.h.

#define STATS_HASH_SIZE   (1<<(STATS_HASH_POWER))

Definition at line 42 of file statistics.h.

#define update_stat ( _var,
_n   ) 


Typedef Documentation

typedef struct module_stats_ module_stats

typedef struct stat_export_ stat_export_t

typedef unsigned long(* stat_function)(void)

Definition at line 57 of file statistics.h.

typedef unsigned int stat_val

Definition at line 52 of file statistics.h.

typedef struct stat_var_ stat_var


Function Documentation

int get_socket_list_from_proto ( int **  ipList,
int  protocol 
)

This function will retrieve a list of all ip addresses and ports that OpenSER is listening on, with respect to the transport protocol specified with 'protocol'.

The first parameter, ipList, is a pointer to a pointer. It will be assigned a new block of memory holding the IP Addresses and ports being listened to with respect to 'protocol'. The array maps a 2D array into a 1 dimensional space, and is layed out as follows:

The first NUM_IP_OCTETS indices will be the IP address, and the next index the port. So if NUM_IP_OCTETS is equal to 4 and there are two IP addresses found, then:

  • ipList[0] will be the first octet of the first ip address
  • ipList[3] will be the last octet of the first ip address.
  • iplist[4] will be the port of the first ip address
  • iplist[5] will be the first octet of the first ip address,
  • and so on.

The function will return the number of sockets which were found. This can be used to index into ipList.

Note:
This function assigns a block of memory equal to:
returnedValue * (NUM_IP_OCTETS + 1) * sizeof(int);

Therefore it is CRUCIAL that you free ipList when you are done with its contents, to avoid a nasty memory leak.

Referenced by init_openserSIPPortTable().

int get_total_bytes_waiting ( void   ) 

Returns the sum of the number of bytes waiting to be consumed on all network interfaces and transports that OpenSER is listening on.

Note: This currently only works on systems supporting the /proc/net/[tcp|udp] interface. On other systems, zero will always be returned. Details of why this is so can be found in network_stats.c

Referenced by check_msg_queue_alarm(), handle_openserMsgQueueDepth(), and rl_timer().


Generated on Thu May 24 14:00:43 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6