Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
29c83ae4
Commit
29c83ae4
authored
Jun 11, 2005
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update a few stats
svn path=/icecast/trunk/icecast/; revision=9437
parent
554649cf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
2 deletions
+29
-2
src/connection.c
src/connection.c
+1
-0
src/source.c
src/source.c
+13
-2
src/source.h
src/source.h
+1
-0
src/stats.c
src/stats.c
+13
-0
src/stats.h
src/stats.h
+1
-0
No files found.
src/connection.c
View file @
29c83ae4
...
@@ -487,6 +487,7 @@ int connection_complete_source (source_t *source)
...
@@ -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
...
...
src/source.c
View file @
29c83ae4
...
@@ -546,6 +546,9 @@ static void send_to_listener (source_t *source, client_t *client, int deletion_e
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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 */
...
...
src/source.h
View file @
29c83ae4
...
@@ -51,6 +51,7 @@ typedef struct source_tag
...
@@ -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
;
...
...
src/stats.c
View file @
29c83ae4
...
@@ -533,6 +533,18 @@ static void process_source_event (stats_event_t *event)
...
@@ -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)
...
@@ -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"
);
...
...
src/stats.h
View file @
29c83ae4
...
@@ -81,6 +81,7 @@ void stats_event_inc(const char *source, const char *name);
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment