Commit b0075635 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove non-working and hardly documented RRD support

parent 52422885
# Create the exchange file
touch rrd
# Create the RRD file
rrdtool create vlc.rrd --step 1 "DS:in:GAUGE:10:0:30000" "DS:demux:GAUGE:10:0:30000" "DS:out:GAUGE:10:0:30000" "RRA:AVERAGE:0,5:1:86400"
# Start "listening" the RRD file
tail -f rrd |while read in;do echo $in;rrdtool update vlc.rrd `echo $in`;done
# Start vlc
vlc normal_vlc_stuff --extraintf logger --rrd-file rrd
# Graph the last 5 minutes (300 seconds)
rrdtool graph vlc.png --start -300 "DEF:inp=vlc.rrd:in:AVERAGE" "DEF:dem=vlc.rrd:demux:AVERAGE" "DEF:out=vlc.rrd:out:AVERAGE" "LINE2:dem#00FF00:Demux bitrate" "LINE2:inp#0000FF:Input bitrate" "LINE2:out#FF0000:Output bitrate"
......@@ -88,12 +88,6 @@ struct msg_cb_data_t
*****************************************************************************/
struct intf_sys_t
{
struct
{
FILE *stream;
vlc_thread_t thread;
} rrd;
msg_subscription_t *p_sub;
msg_cb_data_t msg;
};
......@@ -111,8 +105,6 @@ static void HtmlPrint ( const msg_item_t *, FILE * );
static void SyslogPrint ( const msg_item_t *);
#endif
static void *DoRRD( void * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -150,8 +142,7 @@ vlc_module_begin ()
false )
change_string_list( mode_list, mode_list_text, 0 )
add_file( "rrd-file", NULL, NULL, N_("RRD output file") ,
N_("Output data for RRDTool in this file." ), true )
add_obsolete_string( "rrd-file" )
set_capability( "interface", 0 )
set_callbacks( Open, Close )
......@@ -164,7 +155,7 @@ static int Open( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
intf_sys_t *p_sys;
char *psz_mode, *psz_rrd_file;
char *psz_mode;
CONSOLE_INTRO_MSG;
msg_Info( p_intf, "using logger..." );
......@@ -263,27 +254,6 @@ static int Open( vlc_object_t *p_this )
#endif
}
psz_rrd_file = config_GetPsz( p_intf, "rrd-file" );
if( psz_rrd_file && *psz_rrd_file )
{
FILE *rrd = utf8_fopen( psz_rrd_file, "w" );
if (rrd != NULL)
{
setvbuf (rrd, NULL, _IOLBF, BUFSIZ);
if (!vlc_clone (&p_sys->rrd.thread, DoRRD, p_intf,
VLC_THREAD_PRIORITY_LOW))
p_sys->rrd.stream = rrd;
else
{
fclose (rrd);
p_sys->rrd.stream = NULL;
}
}
}
else
p_sys->rrd.stream = NULL;
free( psz_rrd_file );
p_sys->p_sub = msg_Subscribe( p_intf->p_libvlc, Overflow, &p_sys->msg );
return 0;
......@@ -297,12 +267,6 @@ static void Close( vlc_object_t *p_this )
intf_thread_t *p_intf = (intf_thread_t *)p_this;
intf_sys_t *p_sys = p_intf->p_sys;
if (p_sys->rrd.stream)
{
vlc_cancel (p_sys->rrd.thread);
vlc_join (p_sys->rrd.thread, NULL);
}
/* Flush the queue and unsubscribe from the message queue */
/* FIXME: flush */
msg_Unsubscribe( p_sys->p_sub );
......@@ -407,30 +371,3 @@ static void HtmlPrint( const msg_item_t *p_msg, FILE *p_file )
ppsz_type[p_msg->i_type], ppsz_color[p_msg->i_type],
p_msg->psz_msg );
}
static void *DoRRD (void *data)
{
intf_thread_t *p_intf = data;
FILE *file = p_intf->p_sys->rrd.stream;
for (;;)
{
/* FIXME: I wonder how memory synchronization occurs here...
* -- Courmisch */
if( p_intf->p_libvlc->p_stats )
{
lldiv_t in = lldiv( p_intf->p_libvlc->p_stats->f_input_bitrate * 1000000,
1000 );
lldiv_t dm = lldiv( p_intf->p_libvlc->p_stats->f_demux_bitrate * 1000000,
1000 );
lldiv_t out = lldiv( p_intf->p_libvlc->p_stats->f_output_bitrate * 1000000,
1000 );
fprintf( file,
"%"PRIi64":%lld.%03llu:%lld.%03llu:%lld.%03llu\n",
(int64_t)time(NULL), in.quot, in.rem, dm.quot, dm.rem, out.quot, out.rem );
}
#undef msleep /* yeah, we really want to wake up every second here */
msleep (CLOCK_FREQ);
}
assert (0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment