From b007563549b757a684bc619a472d8897d3b8c6ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sat, 28 Feb 2009 19:15:59 +0200 Subject: [PATCH] Remove non-working and hardly documented RRD support --- doc/rrd-howto.txt | 14 --------- modules/misc/logger.c | 67 ++----------------------------------------- 2 files changed, 2 insertions(+), 79 deletions(-) delete mode 100644 doc/rrd-howto.txt diff --git a/doc/rrd-howto.txt b/doc/rrd-howto.txt deleted file mode 100644 index 007005b035..0000000000 --- a/doc/rrd-howto.txt +++ /dev/null @@ -1,14 +0,0 @@ -# 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" diff --git a/modules/misc/logger.c b/modules/misc/logger.c index 3b49bedb8b..2cd9a7f212 100644 --- a/modules/misc/logger.c +++ b/modules/misc/logger.c @@ -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); -} -- 2.39.2