17 #include <sipwitch-config.h>
18 #include <ucommon/ucommon.h>
19 #include <ucommon/export.h>
25 static unsigned used = 0, total = 7;
26 static stats *base = NULL;
44 create(statmap, total);
66 stats *node = shm(used++);
67 snprintf(node->
id,
sizeof(node->
id),
"%s",
id);
80 return data[0].current +
data[1].current;
88 ++
data[entry].current;
90 data[entry].peak =
data[entry].current;
92 data[entry].max =
data[entry].current;
106 Mutex::protect(
this);
109 --
data[entry].current;
111 data[entry].min =
data[entry].current;
112 Mutex::release(
this);
125 stats *node = shm(pos++);
130 snprintf(text,
sizeof(text),
" %-12s", node->
id);
136 Mutex::protect(node);
137 for(
unsigned entry = 0; entry < 2; ++entry) {
139 snprintf(text + len,
sizeof(text) - len,
" %09lu %05hu %05hu",
150 Mutex::release(node);
152 fprintf(fp,
"%s %ld\n", text, (
long)last);
A stat element of call traffic.
static stats * create(void)
Create stats in shared memory pool.
void assign(stat_t element)
Assign a call to inbound or outbound statistic for this stat node.
Basic server call statistics.
unsigned active(void) const
Total number of active calls in the server at the moment.
static stats * request(const char *id)
Request a stat node from the memory pool by id.
void release(stat_t element)
Release a call from inbound or outbound stastic for this stat node.
static void release(void)
Release stat nodes shared memory segment.
Manage control interface.
struct sipwitch::stats::@9 data[2]
We have stats for both incoming and outgoing traffic of various kinds.
static void allocate(unsigned count)
Server allocate x number of stat nodes at startup.
static const char * env(const char *id)
Return the value of a server environment variable.