[xiph-commits] r9437 - icecast/trunk/icecast/src
karl at motherfish-iii.xiph.org
karl at motherfish-iii.xiph.org
Fri Jun 10 18:25:03 PDT 2005
Author: karl
Date: 2005-06-10 18:24:58 -0700 (Fri, 10 Jun 2005)
New Revision: 9437
Modified:
icecast/trunk/icecast/src/connection.c
icecast/trunk/icecast/src/source.c
icecast/trunk/icecast/src/source.h
icecast/trunk/icecast/src/stats.c
icecast/trunk/icecast/src/stats.h
Log:
update a few stats
Modified: icecast/trunk/icecast/src/connection.c
===================================================================
--- icecast/trunk/icecast/src/connection.c 2005-06-10 19:40:57 UTC (rev 9436)
+++ icecast/trunk/icecast/src/connection.c 2005-06-11 01:24:58 UTC (rev 9437)
@@ -487,6 +487,7 @@
}
global.sources++;
+ stats_event_args (NULL, "sources", "%d", global.sources);
global_unlock();
/* for relays, we don't yet have a client, however we do require one
Modified: icecast/trunk/icecast/src/source.c
===================================================================
--- icecast/trunk/icecast/src/source.c 2005-06-10 19:40:57 UTC (rev 9436)
+++ icecast/trunk/icecast/src/source.c 2005-06-11 01:24:58 UTC (rev 9437)
@@ -546,6 +546,9 @@
}
+/* 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)
{
ice_config_t *config = config_get_config();
@@ -577,6 +580,8 @@
free(listenurl);
}
+ stats_event_args (source->mount, "listener_peak", "0");
+
if (source->dumpfilename != NULL)
{
source->dumpfile = fopen (source->dumpfilename, "ab");
@@ -592,9 +597,10 @@
/* start off the statistics */
source->listeners = 0;
- stats_event_inc (NULL, "sources");
stats_event_inc (NULL, "source_total_connections");
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)
sock_set_blocking (source->con->sock, SOCK_NONBLOCK);
@@ -754,6 +760,11 @@
if (source->listeners != 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);
if (source->listeners == 0 && source->on_demand)
source->running = 0;
@@ -820,7 +831,6 @@
}
/* delete this sources stats */
- stats_event_dec(NULL, "sources");
stats_event(source->mount, NULL, NULL);
/* we don't remove the source from the tree here, it may be a relay and
@@ -829,6 +839,7 @@
global_lock();
global.sources--;
+ stats_event_args (NULL, "sources", "%d", global.sources);
global_unlock();
/* release our hold on the lock so the main thread can continue cleaning up */
Modified: icecast/trunk/icecast/src/source.h
===================================================================
--- icecast/trunk/icecast/src/source.h 2005-06-10 19:40:57 UTC (rev 9436)
+++ icecast/trunk/icecast/src/source.h 2005-06-11 01:24:58 UTC (rev 9437)
@@ -51,6 +51,7 @@
char *dumpfilename; /* Name of a file to dump incoming stream to */
FILE *dumpfile;
+ unsigned long peak_listeners;
unsigned long listeners;
long max_listeners;
int yp_public;
Modified: icecast/trunk/icecast/src/stats.c
===================================================================
--- icecast/trunk/icecast/src/stats.c 2005-06-10 19:40:57 UTC (rev 9436)
+++ icecast/trunk/icecast/src/stats.c 2005-06-11 01:24:58 UTC (rev 9437)
@@ -533,6 +533,18 @@
}
+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)
{
stats_event_t *event;
@@ -540,6 +552,7 @@
event_listener_t *listener;
stats_event (NULL, "server", ICECAST_VERSION_STRING);
+ stats_event_time (NULL, "server_start");
/* global currently active stats */
stats_event (NULL, "clients", "0");
Modified: icecast/trunk/icecast/src/stats.h
===================================================================
--- icecast/trunk/icecast/src/stats.h 2005-06-10 19:40:57 UTC (rev 9436)
+++ icecast/trunk/icecast/src/stats.h 2005-06-11 01:24:58 UTC (rev 9437)
@@ -81,6 +81,7 @@
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_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_callback(void *arg);
More information about the commits
mailing list