SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Data Fields
sipwitch::stats Class Reference

A stat element of call traffic. More...

#include <stats.h>

Collaboration diagram for sipwitch::stats:
Collaboration graph
[legend]

Public Types

enum  stat_t { INCOMING = 0, OUTGOING = 1 }
 

Public Member Functions

void assign (stat_t element)
 Assign a call to inbound or outbound statistic for this stat node. More...
 
void release (stat_t element)
 Release a call from inbound or outbound stastic for this stat node. More...
 
unsigned active (void) const
 Total number of active calls in the server at the moment. More...
 

Static Public Member Functions

static void period (FILE *file=NULL)
 Write out statistics to a file for the current period. More...
 
static statscreate (void)
 Create stats in shared memory pool. More...
 
static statsrequest (const char *id)
 Request a stat node from the memory pool by id. More...
 
static void allocate (unsigned count)
 Server allocate x number of stat nodes at startup. More...
 
static void release (void)
 Release stat nodes shared memory segment. More...
 

Data Fields

char id [12]
 
struct {
   unsigned long   total
 
   unsigned long   period
 
   unsigned long   pperiod
 
   unsigned short   current
 
   unsigned short   peak
 
   unsigned short   min
 
   unsigned short   max
 
   unsigned short   pmin
 
   unsigned short   pmax
 
data [2]
 We have stats for both incoming and outgoing traffic of various kinds. More...
 
time_t lastcall
 
unsigned short limit
 

Detailed Description

A stat element of call traffic.

Stats may cover a specific element for a current time period, and total stats for the life of the server. This is used to determine server utilization, to determine peak times such as may be needed for acd traffic analysis, and to categorize the kind of traffic we are processing through the server. There is a "system" stat node for ALL server call traffic, as well as nodes for collecting stats on all extensions, on all service entries, etc.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 57 of file stats.h.

Member Enumeration Documentation

Enumerator
INCOMING 
OUTGOING 

Definition at line 62 of file stats.h.

Member Function Documentation

unsigned sipwitch::stats::active ( void  ) const

Total number of active calls in the server at the moment.

Returns
total active calls.

Definition at line 78 of file stats.cpp.

void sipwitch::stats::allocate ( unsigned  count)
static

Server allocate x number of stat nodes at startup.

Parameters
numberof stat nodes to allocate.

Definition at line 71 of file stats.cpp.

void sipwitch::stats::assign ( stat_t  element)

Assign a call to inbound or outbound statistic for this stat node.

Increments count.

Parameters
elenent(in or out) to assign to.

Definition at line 83 of file stats.cpp.

stats * sipwitch::stats::create ( void  )
static

Create stats in shared memory pool.

Creates several default statistic nodes for groups of calls, and returns the "system" stat node for the total server.

Definition at line 47 of file stats.cpp.

static void sipwitch::stats::period ( FILE *  file = NULL)
static

Write out statistics to a file for the current period.

The stats are also reset for the new period. The period is also the sync period of the sync event, and is set with the service::period method.

Parameters
fileto write to or NULL for none.
void sipwitch::stats::release ( stat_t  element)

Release a call from inbound or outbound stastic for this stat node.

This is commonly related to call drop and decrements count.

Parameters
element(in or out) to release from.

Definition at line 104 of file stats.cpp.

void sipwitch::stats::release ( void  )
static

Release stat nodes shared memory segment.

Definition at line 98 of file stats.cpp.

stats * sipwitch::stats::request ( const char *  id)
static

Request a stat node from the memory pool by id.

If the node does not exist, it is created.

Returns
node from shared memory or NULL if out of nodes.

Definition at line 59 of file stats.cpp.

Field Documentation

unsigned short sipwitch::stats::current

Definition at line 70 of file stats.h.

struct { ... } sipwitch::stats::data[2]

We have stats for both incoming and outgoing traffic of various kinds.

char sipwitch::stats::id[12]

Definition at line 60 of file stats.h.

time_t sipwitch::stats::lastcall

Definition at line 73 of file stats.h.

unsigned short sipwitch::stats::limit

Definition at line 74 of file stats.h.

unsigned short sipwitch::stats::max

Definition at line 70 of file stats.h.

unsigned short sipwitch::stats::min

Definition at line 70 of file stats.h.

unsigned short sipwitch::stats::peak

Definition at line 70 of file stats.h.

void sipwitch::stats::period

Definition at line 69 of file stats.h.

unsigned short sipwitch::stats::pmax

Definition at line 70 of file stats.h.

unsigned short sipwitch::stats::pmin

Definition at line 70 of file stats.h.

unsigned long sipwitch::stats::pperiod

Definition at line 69 of file stats.h.

unsigned long sipwitch::stats::total

Definition at line 69 of file stats.h.


The documentation for this class was generated from the following files: