Commit 5827c899 authored by zorglub's avatar zorglub
Browse files

Add an option to disable stats (Refs:#473)

parent e1935dc3
......@@ -60,6 +60,9 @@ struct libvlc_t
/* The module bank */
module_bank_t * p_module_bank;
/* Do stats ? - We keep this boolean to avoid unneeded lookups */
vlc_bool_t b_stats;
/* Arch-specific variables */
#if !defined( WIN32 )
vlc_bool_t b_daemon;
......
......@@ -680,6 +680,8 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
p_vlc->pf_memset = memset;
}
libvlc.b_stats = config_GetInt( p_vlc, "stats" );
/*
* Initialize hotkey handling
*/
......
......@@ -767,8 +767,12 @@ static char *ppsz_clock_descriptions[] =
"This option allows you to use a plugins cache which will greatly " \
"improve the start time of VLC.")
#define DAEMON_TEXT N_("Run as daemon process")
#define DAEMON_TEXT N_("Collect statistics")
#define DAEMON_LONGTEXT N_( \
"This option allows you to collect miscellaneous statistics.")
#define STATS_TEXT N_("Run as daemon process")
#define STATS_LONGTEXT N_( \
"Runs VLC as a background daemon process.")
#define ONEINSTANCE_TEXT N_("Allow only one running instance")
......@@ -1359,6 +1363,8 @@ vlc_module_begin();
add_string( "vlm-conf", NULL, NULL, VLM_CONF_TEXT,
VLM_CONF_LONGTEXT, VLC_TRUE );
add_bool ( "stats", VLC_TRUE, NULL, STATS_TEXT, STATS_LONGTEXT, VLC_TRUE );
#if !defined(WIN32)
add_bool( "daemon", 0, NULL, DAEMON_TEXT, DAEMON_LONGTEXT, VLC_TRUE );
change_short('d');
......
......@@ -59,7 +59,13 @@ int __stats_Create( vlc_object_t *p_this, char *psz_name, int i_type,
int i_compute_type )
{
counter_t *p_counter;
stats_handler_t *p_handler = stats_HandlerGet( p_this );
stats_handler_t *p_handler;
if( p_this->p_libvlc->b_stats == VLC_FALSE )
{
return VLC_EGENERIC;
}
p_handler = stats_HandlerGet( p_this );
if( !p_handler ) return VLC_ENOMEM;
vlc_mutex_lock( &p_handler->object_lock );
......@@ -98,7 +104,12 @@ int __stats_Update( vlc_object_t *p_this, char *psz_name, vlc_value_t val )
counter_t *p_counter;
/* Get stats handler singleton */
stats_handler_t *p_handler = stats_HandlerGet( p_this );
stats_handler_t *p_handler;
if( p_this->p_libvlc->b_stats == VLC_FALSE )
{
return VLC_EGENERIC;
}
p_handler = stats_HandlerGet( p_this );
if( !p_handler ) return VLC_ENOMEM;
vlc_mutex_lock( &p_handler->object_lock );
......@@ -132,7 +143,12 @@ int __stats_Get( vlc_object_t *p_this, int i_object_id, char *psz_name, vlc_valu
counter_t *p_counter;
/* Get stats handler singleton */
stats_handler_t *p_handler = stats_HandlerGet( p_this );
stats_handler_t *p_handler;
if( p_this->p_libvlc->b_stats == VLC_FALSE )
{
return VLC_EGENERIC;
}
p_handler = stats_HandlerGet( p_this );
if( !p_handler ) return VLC_ENOMEM;
vlc_mutex_lock( &p_handler->object_lock );
......@@ -205,8 +221,12 @@ counter_t *__stats_CounterGet( vlc_object_t *p_this, int i_object_id,
{
counter_t *p_counter;
/* Get stats handler singleton */
stats_handler_t *p_handler = stats_HandlerGet( p_this );
stats_handler_t *p_handler;
if( p_this->p_libvlc->b_stats == VLC_FALSE )
{
return NULL;
}
p_handler = stats_HandlerGet( p_this );
if( !p_handler ) return NULL;
vlc_mutex_lock( &p_handler->object_lock );
......
......@@ -581,7 +581,7 @@ static void RunThread ( playlist_t *p_playlist )
mtime_t i_vout_destroyed_date = 0;
mtime_t i_sout_destroyed_date = 0;
int i_loops;
int i_loops = 0;
playlist_item_t *p_autodelete_item = NULL;
......@@ -625,8 +625,8 @@ static void RunThread ( playlist_t *p_playlist )
{
stats_ComputeInputStats( p_playlist->p_input,
p_playlist->p_input->input.p_item->p_stats );
// stats_DumpInputStats(
// p_playlist->p_input->input.p_item->p_stats );
// stats_DumpInputStats(
// p_playlist->p_input->input.p_item->p_stats );
}
/* This input is dead. Remove it ! */
......
Supports Markdown
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