mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
update a few stats
svn path=/icecast/trunk/icecast/; revision=9437
This commit is contained in:
parent
554649cf01
commit
29c83ae4eb
@ -487,6 +487,7 @@ int connection_complete_source (source_t *source)
|
|||||||
}
|
}
|
||||||
|
|
||||||
global.sources++;
|
global.sources++;
|
||||||
|
stats_event_args (NULL, "sources", "%d", global.sources);
|
||||||
global_unlock();
|
global_unlock();
|
||||||
|
|
||||||
/* for relays, we don't yet have a client, however we do require one
|
/* for relays, we don't yet have a client, however we do require one
|
||||||
|
15
src/source.c
15
src/source.c
@ -546,6 +546,9 @@ static void send_to_listener (source_t *source, client_t *client, int deletion_e
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Perform any initialisation just before the stream data is processed, the header
|
||||||
|
* info is processed by now and the format details are setup
|
||||||
|
*/
|
||||||
static void source_init (source_t *source)
|
static void source_init (source_t *source)
|
||||||
{
|
{
|
||||||
ice_config_t *config = config_get_config();
|
ice_config_t *config = config_get_config();
|
||||||
@ -577,6 +580,8 @@ static void source_init (source_t *source)
|
|||||||
free(listenurl);
|
free(listenurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stats_event_args (source->mount, "listener_peak", "0");
|
||||||
|
|
||||||
if (source->dumpfilename != NULL)
|
if (source->dumpfilename != NULL)
|
||||||
{
|
{
|
||||||
source->dumpfile = fopen (source->dumpfilename, "ab");
|
source->dumpfile = fopen (source->dumpfilename, "ab");
|
||||||
@ -592,9 +597,10 @@ static void source_init (source_t *source)
|
|||||||
|
|
||||||
/* start off the statistics */
|
/* start off the statistics */
|
||||||
source->listeners = 0;
|
source->listeners = 0;
|
||||||
stats_event_inc (NULL, "sources");
|
|
||||||
stats_event_inc (NULL, "source_total_connections");
|
stats_event_inc (NULL, "source_total_connections");
|
||||||
stats_event (source->mount, "slow_listeners", "0");
|
stats_event (source->mount, "slow_listeners", "0");
|
||||||
|
stats_event (source->mount, "listener_peak", "0");
|
||||||
|
stats_event_time (source->mount, "stream_start");
|
||||||
|
|
||||||
if (source->client->con)
|
if (source->client->con)
|
||||||
sock_set_blocking (source->con->sock, SOCK_NONBLOCK);
|
sock_set_blocking (source->con->sock, SOCK_NONBLOCK);
|
||||||
@ -754,6 +760,11 @@ void source_main (source_t *source)
|
|||||||
if (source->listeners != listeners)
|
if (source->listeners != listeners)
|
||||||
{
|
{
|
||||||
INFO2("listener count on %s now %lu", source->mount, source->listeners);
|
INFO2("listener count on %s now %lu", source->mount, source->listeners);
|
||||||
|
if (source->listeners > source->peak_listeners)
|
||||||
|
{
|
||||||
|
source->peak_listeners = source->listeners;
|
||||||
|
stats_event_args (source->mount, "listener_peak", "%lu", source->peak_listeners);
|
||||||
|
}
|
||||||
stats_event_args (source->mount, "listeners", "%lu", source->listeners);
|
stats_event_args (source->mount, "listeners", "%lu", source->listeners);
|
||||||
if (source->listeners == 0 && source->on_demand)
|
if (source->listeners == 0 && source->on_demand)
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
@ -820,7 +831,6 @@ static void source_shutdown (source_t *source)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* delete this sources stats */
|
/* delete this sources stats */
|
||||||
stats_event_dec(NULL, "sources");
|
|
||||||
stats_event(source->mount, NULL, NULL);
|
stats_event(source->mount, NULL, NULL);
|
||||||
|
|
||||||
/* we don't remove the source from the tree here, it may be a relay and
|
/* we don't remove the source from the tree here, it may be a relay and
|
||||||
@ -829,6 +839,7 @@ static void source_shutdown (source_t *source)
|
|||||||
|
|
||||||
global_lock();
|
global_lock();
|
||||||
global.sources--;
|
global.sources--;
|
||||||
|
stats_event_args (NULL, "sources", "%d", global.sources);
|
||||||
global_unlock();
|
global_unlock();
|
||||||
|
|
||||||
/* release our hold on the lock so the main thread can continue cleaning up */
|
/* release our hold on the lock so the main thread can continue cleaning up */
|
||||||
|
@ -51,6 +51,7 @@ typedef struct source_tag
|
|||||||
char *dumpfilename; /* Name of a file to dump incoming stream to */
|
char *dumpfilename; /* Name of a file to dump incoming stream to */
|
||||||
FILE *dumpfile;
|
FILE *dumpfile;
|
||||||
|
|
||||||
|
unsigned long peak_listeners;
|
||||||
unsigned long listeners;
|
unsigned long listeners;
|
||||||
long max_listeners;
|
long max_listeners;
|
||||||
int yp_public;
|
int yp_public;
|
||||||
|
13
src/stats.c
13
src/stats.c
@ -533,6 +533,18 @@ static void process_source_event (stats_event_t *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void stats_event_time (const char *mount, const char *name)
|
||||||
|
{
|
||||||
|
time_t now = time(NULL);
|
||||||
|
struct tm local;
|
||||||
|
char buffer[100];
|
||||||
|
|
||||||
|
localtime_r (&now, &local);
|
||||||
|
strftime (buffer, sizeof (buffer), "%a, %d %b %Y %H:%M:%S %z", &local);
|
||||||
|
stats_event (mount, name, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void *_stats_thread(void *arg)
|
static void *_stats_thread(void *arg)
|
||||||
{
|
{
|
||||||
stats_event_t *event;
|
stats_event_t *event;
|
||||||
@ -540,6 +552,7 @@ static void *_stats_thread(void *arg)
|
|||||||
event_listener_t *listener;
|
event_listener_t *listener;
|
||||||
|
|
||||||
stats_event (NULL, "server", ICECAST_VERSION_STRING);
|
stats_event (NULL, "server", ICECAST_VERSION_STRING);
|
||||||
|
stats_event_time (NULL, "server_start");
|
||||||
|
|
||||||
/* global currently active stats */
|
/* global currently active stats */
|
||||||
stats_event (NULL, "clients", "0");
|
stats_event (NULL, "clients", "0");
|
||||||
|
@ -81,6 +81,7 @@ void stats_event_inc(const char *source, const char *name);
|
|||||||
void stats_event_add(const char *source, const char *name, unsigned long value);
|
void stats_event_add(const char *source, const char *name, unsigned long value);
|
||||||
void stats_event_dec(const char *source, const char *name);
|
void stats_event_dec(const char *source, const char *name);
|
||||||
void stats_event_hidden (const char *source, const char *name, int hidden);
|
void stats_event_hidden (const char *source, const char *name, int hidden);
|
||||||
|
void stats_event_time (const char *mount, const char *name);
|
||||||
|
|
||||||
void *stats_connection(void *arg);
|
void *stats_connection(void *arg);
|
||||||
void *stats_callback(void *arg);
|
void *stats_callback(void *arg);
|
||||||
|
Loading…
Reference in New Issue
Block a user