Commit baacaea3 authored by Clément Stenac's avatar Clément Stenac

Partial rewrite of stats to avoid lookups (Closes:#693)

parent 7a6b8a51
...@@ -56,7 +56,9 @@ struct libvlc_t ...@@ -56,7 +56,9 @@ struct libvlc_t
/* Do stats ? - We keep this boolean to avoid unneeded lookups */ /* Do stats ? - We keep this boolean to avoid unneeded lookups */
vlc_bool_t b_stats; vlc_bool_t b_stats;
stats_handler_t *p_stats; vlc_mutex_t timer_lock;
int i_timers;
counter_t **pp_timers;
/* Arch-specific variables */ /* Arch-specific variables */
#if !defined( WIN32 ) #if !defined( WIN32 )
......
...@@ -77,6 +77,10 @@ struct httpd_host_t ...@@ -77,6 +77,10 @@ struct httpd_host_t
int i_port; int i_port;
int *fd; int *fd;
/* Statistics */
counter_t *p_active_counter;
counter_t *p_total_counter;
vlc_mutex_t lock; vlc_mutex_t lock;
/* all registered url (becarefull that 2 httpd_url_t could point at the same url) /* all registered url (becarefull that 2 httpd_url_t could point at the same url)
......
...@@ -421,6 +421,26 @@ struct input_thread_t ...@@ -421,6 +421,26 @@ struct input_thread_t
int i_slave; int i_slave;
input_source_t **slave; input_source_t **slave;
/* Stats counters */
struct {
counter_t *p_read_packets;
counter_t *p_read_bytes;
counter_t *p_input_bitrate;
counter_t *p_demux_read;
counter_t *p_demux_bitrate;
counter_t *p_decoded_audio;
counter_t *p_decoded_video;
counter_t *p_decoded_sub;
counter_t *p_sout_sent_packets;
counter_t *p_sout_sent_bytes;
counter_t *p_sout_send_bitrate;
counter_t *p_played_abuffers;
counter_t *p_lost_abuffers;
counter_t *p_displayed_pictures;
counter_t *p_lost_pictures;
vlc_mutex_t counters_lock;
} counters;
/* Buffer of pending actions */ /* Buffer of pending actions */
vlc_mutex_t lock_control; vlc_mutex_t lock_control;
int i_control; int i_control;
......
...@@ -228,8 +228,7 @@ struct counter_sample_t ...@@ -228,8 +228,7 @@ struct counter_sample_t
struct counter_t struct counter_t
{ {
/* The list is *NOT* sorted at the moment, it could be ... */ unsigned int i_id;
uint64_t i_index;
char * psz_name; char * psz_name;
int i_type; int i_type;
int i_compute_type; int i_compute_type;
...@@ -267,70 +266,58 @@ enum ...@@ -267,70 +266,58 @@ enum
STATS_TIMER_SKINS_PLAYTREE_IMAGE, STATS_TIMER_SKINS_PLAYTREE_IMAGE,
}; };
struct stats_handler_t #define stats_Update(a,b,c) __stats_Update( VLC_OBJECT(a), b, c )
{ VLC_EXPORT( int, __stats_Update, (vlc_object_t*, counter_t *, vlc_value_t, vlc_value_t *) );
VLC_COMMON_MEMBERS #define stats_CounterCreate(a,b,c) __stats_CounterCreate( VLC_OBJECT(a), b, c )
VLC_EXPORT( counter_t *, __stats_CounterCreate, (vlc_object_t*, int, int) );
int i_counters; #define stats_Get(a,b,c) __stats_Get( VLC_OBJECT(a), b, c)
counter_t **pp_counters; VLC_EXPORT( int, __stats_Get, (vlc_object_t*, counter_t *, vlc_value_t*) );
};
VLC_EXPORT( void, stats_HandlerDestroy, (stats_handler_t*) );
#define stats_Update(a,b,c,d) __stats_Update( VLC_OBJECT( a ), b, c, d ) VLC_EXPORT (void, stats_CounterClean, (counter_t * ) );
VLC_EXPORT( int, __stats_Update, (vlc_object_t*, unsigned int, vlc_value_t, vlc_value_t *) );
#define stats_Create(a,b,c,d,e) __stats_Create( VLC_OBJECT(a), b, c, d,e )
VLC_EXPORT( int, __stats_Create, (vlc_object_t*, const char *, unsigned int, int, int) );
#define stats_Get(a,b,c,d) __stats_Get( VLC_OBJECT(a), b, c, d )
VLC_EXPORT( int, __stats_Get, (vlc_object_t*, int, unsigned int, vlc_value_t*) );
#define stats_CounterGet(a,b,c) __stats_CounterGet( VLC_OBJECT(a), b, c )
VLC_EXPORT( counter_t*, __stats_CounterGet, (vlc_object_t*, int, unsigned int ) );
#define stats_GetInteger(a,b,c,d) __stats_GetInteger( VLC_OBJECT(a), b, c, d ) #define stats_GetInteger(a,b,c) __stats_GetInteger( VLC_OBJECT(a), b, c )
static inline int __stats_GetInteger( vlc_object_t *p_obj, int i_id, static inline int __stats_GetInteger( vlc_object_t *p_obj, counter_t *p_counter,
unsigned int i_counter, int *value ) int *value )
{ {
int i_ret; int i_ret;
vlc_value_t val; val.i_int = 0; vlc_value_t val; val.i_int = 0;
i_ret = __stats_Get( p_obj, i_id, i_counter, &val ); i_ret = __stats_Get( p_obj, p_counter, &val );
*value = val.i_int; *value = val.i_int;
return i_ret; return i_ret;
} }
#define stats_GetFloat(a,b,c,d) __stats_GetFloat( VLC_OBJECT(a), b, c, d ) #define stats_GetFloat(a,b,c) __stats_GetFloat( VLC_OBJECT(a), b, c )
static inline int __stats_GetFloat( vlc_object_t *p_obj, int i_id, static inline int __stats_GetFloat( vlc_object_t *p_obj, counter_t *p_counter,
unsigned int i_counter, float *value ) float *value )
{ {
int i_ret; int i_ret;
vlc_value_t val; val.f_float = 0.0; vlc_value_t val; val.f_float = 0.0;
i_ret = __stats_Get( p_obj, i_id, i_counter, &val ); i_ret = __stats_Get( p_obj, p_counter, &val );
*value = val.f_float; *value = val.f_float;
return i_ret; return i_ret;
} }
#define stats_UpdateInteger(a,b,c,d) __stats_UpdateInteger( VLC_OBJECT(a),b,c,d ) #define stats_UpdateInteger(a,b,c,d) __stats_UpdateInteger( VLC_OBJECT(a),b,c,d )
static inline int __stats_UpdateInteger( vlc_object_t *p_obj, static inline int __stats_UpdateInteger( vlc_object_t *p_obj,counter_t *p_co,
unsigned int i_counter, int i, int i, int *pi_new )
int *pi_new )
{ {
int i_ret; int i_ret;
vlc_value_t val; vlc_value_t val;
vlc_value_t new_val; new_val.i_int = 0; vlc_value_t new_val; new_val.i_int = 0;
val.i_int = i; val.i_int = i;
i_ret = __stats_Update( p_obj, i_counter, val , &new_val ); i_ret = __stats_Update( p_obj, p_co, val, &new_val );
if( pi_new ) if( pi_new )
*pi_new = new_val.i_int; *pi_new = new_val.i_int;
return i_ret; return i_ret;
} }
#define stats_UpdateFloat(a,b,c,d) __stats_UpdateFloat( VLC_OBJECT(a),b,c,d ) #define stats_UpdateFloat(a,b,c,d) __stats_UpdateFloat( VLC_OBJECT(a),b,c,d )
static inline int __stats_UpdateFloat( vlc_object_t *p_obj, static inline int __stats_UpdateFloat( vlc_object_t *p_obj, counter_t *p_co,
unsigned int i_counter, float f, float f, float *pf_new )
float *pf_new )
{ {
vlc_value_t val; vlc_value_t val;
int i_ret; int i_ret;
vlc_value_t new_val;new_val.f_float = 0.0; vlc_value_t new_val;new_val.f_float = 0.0;
val.f_float = f; val.f_float = f;
i_ret = __stats_Update( p_obj, i_counter, val, &new_val ); i_ret = __stats_Update( p_obj, p_co, val, &new_val );
if( pf_new ) if( pf_new )
*pf_new = new_val.f_float; *pf_new = new_val.f_float;
return i_ret; return i_ret;
...@@ -413,3 +400,5 @@ VLC_EXPORT( void,__stats_TimerStart, (vlc_object_t*, const char *, unsigned int ...@@ -413,3 +400,5 @@ VLC_EXPORT( void,__stats_TimerStart, (vlc_object_t*, const char *, unsigned int
VLC_EXPORT( void,__stats_TimerStop, (vlc_object_t*, unsigned int) ); VLC_EXPORT( void,__stats_TimerStop, (vlc_object_t*, unsigned int) );
VLC_EXPORT( void,__stats_TimerDump, (vlc_object_t*, unsigned int) ); VLC_EXPORT( void,__stats_TimerDump, (vlc_object_t*, unsigned int) );
VLC_EXPORT( void,__stats_TimersDumpAll, (vlc_object_t*) ); VLC_EXPORT( void,__stats_TimersDumpAll, (vlc_object_t*) );
#define stats_TimersClean(a) __stats_TimersClean( VLC_OBJECT(a) )
VLC_EXPORT( void, __stats_TimersClean, (vlc_object_t * ) );
...@@ -438,16 +438,15 @@ struct module_symbols_t ...@@ -438,16 +438,15 @@ struct module_symbols_t
int (*__intf_UserProgress_inner) (vlc_object_t*, const char*, const char*, float); int (*__intf_UserProgress_inner) (vlc_object_t*, const char*, const char*, float);
void (*__intf_UserProgressUpdate_inner) (vlc_object_t*, int, const char*, float); void (*__intf_UserProgressUpdate_inner) (vlc_object_t*, int, const char*, float);
void (*__intf_UserHide_inner) (vlc_object_t *, int); void (*__intf_UserHide_inner) (vlc_object_t *, int);
int (*__stats_Create_inner) (vlc_object_t*, const char *, unsigned int, int, int); void *__stats_Create_deprecated;
int (*__stats_Update_inner) (vlc_object_t*, unsigned int, vlc_value_t, vlc_value_t *); int (*__stats_Update_inner) (vlc_object_t*, counter_t *, vlc_value_t, vlc_value_t *);
int (*__stats_Get_inner) (vlc_object_t*, int, unsigned int, vlc_value_t*); int (*__stats_Get_inner) (vlc_object_t*, counter_t *, vlc_value_t*);
void (*stats_ComputeInputStats_inner) (input_thread_t*, input_stats_t*); void (*stats_ComputeInputStats_inner) (input_thread_t*, input_stats_t*);
void (*stats_DumpInputStats_inner) (input_stats_t *); void (*stats_DumpInputStats_inner) (input_stats_t *);
void (*stats_ReinitInputStats_inner) (input_stats_t *); void (*stats_ReinitInputStats_inner) (input_stats_t *);
counter_t* (*__stats_CounterGet_inner) (vlc_object_t*, int, unsigned int);
void *__stats_CounterGet_deprecated; void *__stats_CounterGet_deprecated;
input_thread_t * (*__input_CreateThread2_inner) (vlc_object_t *, input_item_t *, char *); input_thread_t * (*__input_CreateThread2_inner) (vlc_object_t *, input_item_t *, char *);
void (*stats_HandlerDestroy_inner) (stats_handler_t*); void *stats_HandlerDestroy_deprecated;
vlc_t * (*vlc_current_object_inner) (int); vlc_t * (*vlc_current_object_inner) (int);
void (*__var_OptionParse_inner) (vlc_object_t *, const char *); void (*__var_OptionParse_inner) (vlc_object_t *, const char *);
void *__stats_TimerDumpAll_deprecated; void *__stats_TimerDumpAll_deprecated;
...@@ -514,6 +513,10 @@ struct module_symbols_t ...@@ -514,6 +513,10 @@ struct module_symbols_t
int (*__intf_UserStringInput_inner) (vlc_object_t*, const char*, const char*, char **); int (*__intf_UserStringInput_inner) (vlc_object_t*, const char*, const char*, char **);
void (*playlist_NodesCreateForSD_inner) (playlist_t *, char *, playlist_item_t **, playlist_item_t **); void (*playlist_NodesCreateForSD_inner) (playlist_t *, char *, playlist_item_t **, playlist_item_t **);
vlc_bool_t (*input_AddSubtitles_inner) (input_thread_t *, char *, vlc_bool_t); vlc_bool_t (*input_AddSubtitles_inner) (input_thread_t *, char *, vlc_bool_t);
counter_t * (*__stats_CounterCreate_inner) (vlc_object_t*, int, int);
void *stats_TimerClean_deprecated;
void *stats_TimersClean_deprecated;
void (*__stats_TimersClean_inner) (vlc_object_t *);
}; };
# if defined (__PLUGIN__) # if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner # define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...@@ -909,15 +912,12 @@ struct module_symbols_t ...@@ -909,15 +912,12 @@ struct module_symbols_t
# define __intf_UserProgress (p_symbols)->__intf_UserProgress_inner # define __intf_UserProgress (p_symbols)->__intf_UserProgress_inner
# define __intf_UserProgressUpdate (p_symbols)->__intf_UserProgressUpdate_inner # define __intf_UserProgressUpdate (p_symbols)->__intf_UserProgressUpdate_inner
# define __intf_UserHide (p_symbols)->__intf_UserHide_inner # define __intf_UserHide (p_symbols)->__intf_UserHide_inner
# define __stats_Create (p_symbols)->__stats_Create_inner
# define __stats_Update (p_symbols)->__stats_Update_inner # define __stats_Update (p_symbols)->__stats_Update_inner
# define __stats_Get (p_symbols)->__stats_Get_inner # define __stats_Get (p_symbols)->__stats_Get_inner
# define stats_ComputeInputStats (p_symbols)->stats_ComputeInputStats_inner # define stats_ComputeInputStats (p_symbols)->stats_ComputeInputStats_inner
# define stats_DumpInputStats (p_symbols)->stats_DumpInputStats_inner # define stats_DumpInputStats (p_symbols)->stats_DumpInputStats_inner
# define stats_ReinitInputStats (p_symbols)->stats_ReinitInputStats_inner # define stats_ReinitInputStats (p_symbols)->stats_ReinitInputStats_inner
# define __stats_CounterGet (p_symbols)->__stats_CounterGet_inner
# define __input_CreateThread2 (p_symbols)->__input_CreateThread2_inner # define __input_CreateThread2 (p_symbols)->__input_CreateThread2_inner
# define stats_HandlerDestroy (p_symbols)->stats_HandlerDestroy_inner
# define vlc_current_object (p_symbols)->vlc_current_object_inner # define vlc_current_object (p_symbols)->vlc_current_object_inner
# define __var_OptionParse (p_symbols)->__var_OptionParse_inner # define __var_OptionParse (p_symbols)->__var_OptionParse_inner
# define __stats_TimerDump (p_symbols)->__stats_TimerDump_inner # define __stats_TimerDump (p_symbols)->__stats_TimerDump_inner
...@@ -982,6 +982,8 @@ struct module_symbols_t ...@@ -982,6 +982,8 @@ struct module_symbols_t
# define __intf_UserStringInput (p_symbols)->__intf_UserStringInput_inner # define __intf_UserStringInput (p_symbols)->__intf_UserStringInput_inner
# define playlist_NodesCreateForSD (p_symbols)->playlist_NodesCreateForSD_inner # define playlist_NodesCreateForSD (p_symbols)->playlist_NodesCreateForSD_inner
# define input_AddSubtitles (p_symbols)->input_AddSubtitles_inner # define input_AddSubtitles (p_symbols)->input_AddSubtitles_inner
# define __stats_CounterCreate (p_symbols)->__stats_CounterCreate_inner
# define __stats_TimersClean (p_symbols)->__stats_TimersClean_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/****************************************************************** /******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access. * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...@@ -1380,15 +1382,12 @@ struct module_symbols_t ...@@ -1380,15 +1382,12 @@ struct module_symbols_t
((p_symbols)->__intf_UserProgress_inner) = __intf_UserProgress; \ ((p_symbols)->__intf_UserProgress_inner) = __intf_UserProgress; \
((p_symbols)->__intf_UserProgressUpdate_inner) = __intf_UserProgressUpdate; \ ((p_symbols)->__intf_UserProgressUpdate_inner) = __intf_UserProgressUpdate; \
((p_symbols)->__intf_UserHide_inner) = __intf_UserHide; \ ((p_symbols)->__intf_UserHide_inner) = __intf_UserHide; \
((p_symbols)->__stats_Create_inner) = __stats_Create; \
((p_symbols)->__stats_Update_inner) = __stats_Update; \ ((p_symbols)->__stats_Update_inner) = __stats_Update; \
((p_symbols)->__stats_Get_inner) = __stats_Get; \ ((p_symbols)->__stats_Get_inner) = __stats_Get; \
((p_symbols)->stats_ComputeInputStats_inner) = stats_ComputeInputStats; \ ((p_symbols)->stats_ComputeInputStats_inner) = stats_ComputeInputStats; \
((p_symbols)->stats_DumpInputStats_inner) = stats_DumpInputStats; \ ((p_symbols)->stats_DumpInputStats_inner) = stats_DumpInputStats; \
((p_symbols)->stats_ReinitInputStats_inner) = stats_ReinitInputStats; \ ((p_symbols)->stats_ReinitInputStats_inner) = stats_ReinitInputStats; \
((p_symbols)->__stats_CounterGet_inner) = __stats_CounterGet; \
((p_symbols)->__input_CreateThread2_inner) = __input_CreateThread2; \ ((p_symbols)->__input_CreateThread2_inner) = __input_CreateThread2; \
((p_symbols)->stats_HandlerDestroy_inner) = stats_HandlerDestroy; \
((p_symbols)->vlc_current_object_inner) = vlc_current_object; \ ((p_symbols)->vlc_current_object_inner) = vlc_current_object; \
((p_symbols)->__var_OptionParse_inner) = __var_OptionParse; \ ((p_symbols)->__var_OptionParse_inner) = __var_OptionParse; \
((p_symbols)->__stats_TimerDump_inner) = __stats_TimerDump; \ ((p_symbols)->__stats_TimerDump_inner) = __stats_TimerDump; \
...@@ -1453,6 +1452,8 @@ struct module_symbols_t ...@@ -1453,6 +1452,8 @@ struct module_symbols_t
((p_symbols)->__intf_UserStringInput_inner) = __intf_UserStringInput; \ ((p_symbols)->__intf_UserStringInput_inner) = __intf_UserStringInput; \
((p_symbols)->playlist_NodesCreateForSD_inner) = playlist_NodesCreateForSD; \ ((p_symbols)->playlist_NodesCreateForSD_inner) = playlist_NodesCreateForSD; \
((p_symbols)->input_AddSubtitles_inner) = input_AddSubtitles; \ ((p_symbols)->input_AddSubtitles_inner) = input_AddSubtitles; \
((p_symbols)->__stats_CounterCreate_inner) = __stats_CounterCreate; \
((p_symbols)->__stats_TimersClean_inner) = __stats_TimersClean; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \ (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__playlist_ItemCopy_deprecated = NULL; \ (p_symbols)->__playlist_ItemCopy_deprecated = NULL; \
(p_symbols)->playlist_ItemAddParent_deprecated = NULL; \ (p_symbols)->playlist_ItemAddParent_deprecated = NULL; \
...@@ -1479,9 +1480,13 @@ struct module_symbols_t ...@@ -1479,9 +1480,13 @@ struct module_symbols_t
(p_symbols)->playlist_Sort_deprecated = NULL; \ (p_symbols)->playlist_Sort_deprecated = NULL; \
(p_symbols)->playlist_Move_deprecated = NULL; \ (p_symbols)->playlist_Move_deprecated = NULL; \
(p_symbols)->playlist_NodeRemoveParent_deprecated = NULL; \ (p_symbols)->playlist_NodeRemoveParent_deprecated = NULL; \
(p_symbols)->__stats_Create_deprecated = NULL; \
(p_symbols)->__stats_CounterGet_deprecated = NULL; \ (p_symbols)->__stats_CounterGet_deprecated = NULL; \
(p_symbols)->stats_HandlerDestroy_deprecated = NULL; \
(p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \ (p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
(p_symbols)->playlist_ItemNewFromInput_deprecated = NULL; \ (p_symbols)->playlist_ItemNewFromInput_deprecated = NULL; \
(p_symbols)->stats_TimerClean_deprecated = NULL; \
(p_symbols)->stats_TimersClean_deprecated = NULL; \
# endif /* __PLUGIN__ */ # endif /* __PLUGIN__ */
#endif /* __VLC_SYMBOLS_H */ #endif /* __VLC_SYMBOLS_H */
...@@ -312,8 +312,11 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -312,8 +312,11 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
p_buffer->start_date - mdate()); p_buffer->start_date - mdate());
if( p_input->p_input_thread ) if( p_input->p_input_thread )
{ {
stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1, vlc_mutex_lock( &p_input->p_input_thread->counters.counters_lock);
NULL ); stats_UpdateInteger( p_aout,
p_input->p_input_thread->counters.p_lost_abuffers,
1, NULL );
vlc_mutex_unlock( &p_input->p_input_thread->counters.counters_lock);
} }
aout_BufferFree( p_buffer ); aout_BufferFree( p_buffer );
return -1; return -1;
...@@ -367,8 +370,11 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -367,8 +370,11 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_MixerRun( p_aout ); aout_MixerRun( p_aout );
if( p_input->p_input_thread ) if( p_input->p_input_thread )
{ {
stats_UpdateInteger( p_input->p_input_thread, vlc_mutex_lock( &p_input->p_input_thread->counters.counters_lock);
STATS_PLAYED_ABUFFERS, 1, NULL ); stats_UpdateInteger( p_aout,
p_input->p_input_thread->counters.p_lost_abuffers,
1, NULL );
vlc_mutex_unlock( &p_input->p_input_thread->counters.counters_lock);
} }
vlc_mutex_unlock( &p_aout->mixer_lock ); vlc_mutex_unlock( &p_aout->mixer_lock );
......
...@@ -449,8 +449,9 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -449,8 +449,9 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
start_date = 0; start_date = 0;
if( p_input->p_input_thread ) if( p_input->p_input_thread )
{ {
stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1, vlc_mutex_lock( &p_input->p_input_thread->counters.counters_lock);
NULL ); stats_UpdateInteger( p_aout, p_input->p_input_thread->counters.p_lost_abuffers, 1, NULL );
vlc_mutex_unlock( &p_input->p_input_thread->counters.counters_lock);
} }
} }
...@@ -462,8 +463,9 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -462,8 +463,9 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
mdate() - p_buffer->start_date ); mdate() - p_buffer->start_date );
if( p_input->p_input_thread ) if( p_input->p_input_thread )
{ {
stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, vlc_mutex_lock( &p_input->p_input_thread->counters.counters_lock);
1, NULL ); stats_UpdateInteger( p_aout, p_input->p_input_thread->counters.p_lost_abuffers, 1, NULL );
vlc_mutex_unlock( &p_input->p_input_thread->counters.counters_lock);
} }
aout_BufferFree( p_buffer ); aout_BufferFree( p_buffer );
p_input->i_resampling_type = AOUT_RESAMPLING_NONE; p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
...@@ -504,8 +506,9 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -504,8 +506,9 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_BufferFree( p_buffer ); aout_BufferFree( p_buffer );
if( p_input->p_input_thread ) if( p_input->p_input_thread )
{ {
stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, vlc_mutex_lock( &p_input->p_input_thread->counters.counters_lock);
1, NULL ); stats_UpdateInteger( p_aout, p_input->p_input_thread->counters.p_lost_abuffers, 1, NULL );
vlc_mutex_unlock( &p_input->p_input_thread->counters.counters_lock);
} }
return 0; return 0;
} }
......
...@@ -429,12 +429,6 @@ static decoder_t * CreateDecoder( input_thread_t *p_input, ...@@ -429,12 +429,6 @@ static decoder_t * CreateDecoder( input_thread_t *p_input,
vlc_object_attach( p_dec, p_input ); vlc_object_attach( p_dec, p_input );
stats_Create( p_dec->p_parent, "decoded_audio", STATS_DECODED_AUDIO,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_dec->p_parent, "decoded_video", STATS_DECODED_VIDEO,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_dec->p_parent, "decoded_sub", STATS_DECODED_SUB,
VLC_VAR_INTEGER, STATS_COUNTER );
/* Find a suitable decoder/packetizer module */ /* Find a suitable decoder/packetizer module */
if( i_object_type == VLC_OBJECT_DECODER ) if( i_object_type == VLC_OBJECT_DECODER )
p_dec->p_module = module_Need( p_dec, "decoder", "$codec", 0 ); p_dec->p_module = module_Need( p_dec, "decoder", "$codec", 0 );
...@@ -627,9 +621,14 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block ) ...@@ -627,9 +621,14 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, while( (p_aout_buf = p_dec->pf_decode_audio( p_dec,
&p_packetized_block )) ) &p_packetized_block )) )
{ {
stats_UpdateInteger( p_dec->p_parent, input_thread_t *p_i =(input_thread_t*)(p_dec->p_parent);
STATS_DECODED_AUDIO, 1, NULL ); vlc_mutex_lock( &p_i->counters.counters_lock );
/* FIXME the best would be to handle the case start_date < preroll < end_date stats_UpdateInteger( p_dec,
p_i->counters.p_decoded_audio, 1, NULL );
vlc_mutex_unlock( &p_i->counters.counters_lock );
/* FIXME the best would be to handle the case
* start_date < preroll < end_date
* but that's not easy with non raw audio stream */ * but that's not easy with non raw audio stream */
if( p_dec->p_owner->i_preroll_end > 0 && if( p_dec->p_owner->i_preroll_end > 0 &&
p_aout_buf->start_date < p_dec->p_owner->i_preroll_end ) p_aout_buf->start_date < p_dec->p_owner->i_preroll_end )
...@@ -652,7 +651,12 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block ) ...@@ -652,7 +651,12 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
} }
else while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) ) else while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) )
{ {
stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_AUDIO, 1, NULL ); input_thread_t *p_i = (input_thread_t*)(p_dec->p_parent);
vlc_mutex_lock( &p_i->counters.counters_lock );
stats_UpdateInteger( p_dec,
p_i->counters.p_decoded_audio, 1, NULL );
vlc_mutex_unlock( &p_i->counters.counters_lock );
if( p_dec->p_owner->i_preroll_end > 0 && if( p_dec->p_owner->i_preroll_end > 0 &&
p_aout_buf->start_date < p_dec->p_owner->i_preroll_end ) p_aout_buf->start_date < p_dec->p_owner->i_preroll_end )
{ {
...@@ -698,8 +702,12 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block ) ...@@ -698,8 +702,12 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
while( (p_pic = p_dec->pf_decode_video( p_dec, while( (p_pic = p_dec->pf_decode_video( p_dec,
&p_packetized_block )) ) &p_packetized_block )) )
{ {
stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_VIDEO, input_thread_t *p_i =(input_thread_t*)(p_dec->p_parent);
1, NULL ); vlc_mutex_lock( &p_i->counters.counters_lock );
stats_UpdateInteger( p_dec,
p_i->counters.p_decoded_video, 1, NULL );
vlc_mutex_unlock( &p_i->counters.counters_lock );
if( p_dec->p_owner->i_preroll_end > 0 && if( p_dec->p_owner->i_preroll_end > 0 &&
p_pic->date < p_dec->p_owner->i_preroll_end ) p_pic->date < p_dec->p_owner->i_preroll_end )
{ {
...@@ -720,7 +728,12 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block ) ...@@ -720,7 +728,12 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
} }
else while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) ) else while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) )
{ {
stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_VIDEO, 1 , NULL); input_thread_t *p_i = (input_thread_t*)(p_dec->p_parent);
vlc_mutex_lock( &p_i->counters.counters_lock );
stats_UpdateInteger( p_dec,
p_i->counters.p_decoded_video, 1, NULL );
vlc_mutex_unlock( &p_i->counters.counters_lock );
if( p_dec->p_owner->i_preroll_end > 0 && if( p_dec->p_owner->i_preroll_end > 0 &&
p_pic->date < p_dec->p_owner->i_preroll_end ) p_pic->date < p_dec->p_owner->i_preroll_end )
{ {
...@@ -740,7 +753,12 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block ) ...@@ -740,7 +753,12 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
subpicture_t *p_spu; subpicture_t *p_spu;
while( (p_spu = p_dec->pf_decode_sub( p_dec, &p_block ) ) ) while( (p_spu = p_dec->pf_decode_sub( p_dec, &p_block ) ) )
{ {
stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_SUB, 1 , NULL); input_thread_t *p_i = (input_thread_t*)(p_dec->p_parent);
vlc_mutex_lock( &p_i->counters.counters_lock );
stats_UpdateInteger( p_dec,
p_i->counters.p_decoded_sub, 1, NULL );
vlc_mutex_unlock( &p_i->counters.counters_lock );
if( p_dec->p_owner->i_preroll_end > 0 && if( p_dec->p_owner->i_preroll_end > 0 &&
p_spu->i_start < p_dec->p_owner->i_preroll_end && p_spu->i_start < p_dec->p_owner->i_preroll_end &&
( p_spu->i_stop <= 0 || p_spu->i_stop <= p_dec->p_owner->i_preroll_end ) ) ( p_spu->i_stop <= 0 || p_spu->i_stop <= p_dec->p_owner->i_preroll_end ) )
......
...@@ -1025,9 +1025,12 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block ) ...@@ -1025,9 +1025,12 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
if( p_input->p_libvlc->b_stats ) if( p_input->p_libvlc->b_stats )
{ {
stats_UpdateInteger( p_input, STATS_DEMUX_READ, p_block->i_buffer, vlc_mutex_lock( &p_input->counters.counters_lock );
&i_total ); stats_UpdateInteger( p_input, p_input->counters.p_demux_read,
stats_UpdateFloat( p_input , STATS_DEMUX_BITRATE, (float)i_total, NULL ); p_block->i_buffer, &i_total );
stats_UpdateFloat( p_input , p_input->counters.p_demux_bitrate,
(float)i_total, NULL );
vlc_mutex_unlock( &p_input->counters.counters_lock );
} }
/* Mark preroll blocks */ /* Mark preroll blocks */
......
...@@ -679,29 +679,27 @@ static int Init( input_thread_t * p_input, vlc_bool_t b_quick ) ...@@ -679,29 +679,27 @@ static int Init( input_thread_t * p_input, vlc_bool_t b_quick )
if( !b_quick ) if( !b_quick )
{ {
/* Prepare statistics */ /* Prepare statistics */
counter_t *p_counter; #define INIT_COUNTER( p, type, compute ) p_input->counters.p_##p = \
stats_Create( p_input, "read_bytes", STATS_READ_BYTES, stats_CounterCreate( p_input, VLC_VAR_##type, STATS_##compute);
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "read_packets", STATS_READ_PACKETS, INIT_COUNTER( read_bytes, INTEGER, COUNTER );
VLC_VAR_INTEGER, STATS_COUNTER ); INIT_COUNTER( read_packets, INTEGER, COUNTER );
stats_Create( p_input, "demux_read", STATS_DEMUX_READ, INIT_COUNTER( demux_read, INTEGER, COUNTER );
VLC_VAR_INTEGER, STATS_COUNTER ); INIT_COUNTER( input_bitrate, FLOAT, DERIVATIVE );
stats_Create( p_input, "input_bitrate", STATS_INPUT_BITRATE, INIT_COUNTER( demux_bitrate, FLOAT, DERIVATIVE );
VLC_VAR_FLOAT, STATS_DERIVATIVE ); INIT_COUNTER( played_abuffers, INTEGER, COUNTER );
stats_Create( p_input, "demux_bitrate", STATS_DEMUX_BITRATE, INIT_COUNTER( lost_abuffers, INTEGER, COUNTER );
VLC_VAR_FLOAT, STATS_DERIVATIVE ); INIT_COUNTER( displayed_pictures, INTEGER, COUNTER );
INIT_COUNTER( lost_pictures, INTEGER, COUNTER );
p_counter = stats_CounterGet( p_input, p_input->i_object_id, INIT_COUNTER( decoded_audio, INTEGER, COUNTER );
STATS_INPUT_BITRATE ); INIT_COUNTER( decoded_video, INTEGER, COUNTER );
if( p_counter ) p_counter->update_interval = 1000000; INIT_COUNTER( decoded_sub, INTEGER, COUNTER );
p_counter = stats_CounterGet( p_input, p_input->i_object_id, p_input->counters.p_sout_send_bitrate = NULL;
STATS_DEMUX_BITRATE ); p_input->counters.p_sout_sent_packets = NULL;
if( p_counter ) p_counter->update_interval = 1000000; p_input->counters.p_sout_sent_bytes = NULL;
p_input->counters.p_demux_bitrate->update_interval = 1000000;
stats_Create( p_input, "played_abuffers", STATS_PLAYED_ABUFFERS, p_input->counters.p_input_bitrate->update_interval = 1000000;
VLC_VAR_INTEGER, STATS_COUNTER ); vlc_mutex_init( p_input, &p_input->counters.counters_lock );
stats_Create( p_input, "lost_abuffers", STATS_LOST_ABUFFERS,
VLC_VAR_INTEGER, STATS_COUNTER );
/* handle sout */ /* handle sout */
psz = var_GetString( p_input, "sout" ); psz = var_GetString( p_input, "sout" );
...@@ -715,6 +713,10 @@ static int Init( input_thread_t * p_input, vlc_bool_t b_quick ) ...@@ -715,6 +713,10 @@ static int Init( input_thread_t * p_input, vlc_bool_t b_quick )
free( psz ); free( psz );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
INIT_COUNTER( sout_sent_packets, INTEGER, COUNTER );
INIT_COUNTER (sout_sent_bytes, INTEGER, COUNTER );
INIT_COUNTER( sout_send_bitrate, FLOAT, DERIVATIVE );
p_input->counters.p_sout_send_bitrate->update_interval = 1000000;
} }
free( psz ); free( psz );
} }
...@@ -1105,6 +1107,22 @@ static void End( input_thread_t * p_input ) ...@@ -1105,6 +1107,22 @@ static void End( input_thread_t * p_input )
if( p_input->p_es_out ) if( p_input->p_es_out )
input_EsOutDelete( p_input->p_es_out ); input_EsOutDelete( p_input->p_es_out );
#define CL_CO( c ) stats_CounterClean( p_input->counters.p_##c )
CL_CO( read_bytes );
CL_CO( read_packets );
CL_CO( demux_read );
CL_CO( input_bitrate );
CL_CO( demux_bitrate );
CL_CO( played_abuffers );
CL_CO( lost_abuffers );
CL_CO( displayed_pictures );
CL_CO( lost_pictures );
CL_CO( decoded_audio) ;
CL_CO( decoded_video );
CL_CO( decoded_sub) ;
CL_CO( read_bytes );
/* Close optional stream output instance */ /* Close optional stream output instance */
if( p_input->p_sout ) if( p_input->p_sout )
{ {
...@@ -1112,6 +1130,10 @@ static void End( input_thread_t * p_input ) ...@@ -1112,6 +1130,10 @@ static void End( input_thread_t * p_input )
vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
vlc_value_t keep; vlc_value_t keep;
CL_CO( sout_sent_packets );
CL_CO( sout_sent_bytes );
CL_CO( sout_send_bitrate );
if( var_Get( p_input, "sout-keep", &keep ) >= 0 && keep.b_bool && p_pl ) if( var_Get( p_input, "sout-keep", &keep ) >= 0 && keep.b_bool && p_pl )
{ {
/* attach sout to the playlist */ /* attach sout to the playlist */
...@@ -1128,6 +1150,7 @@ static void End( input_thread_t * p_input ) ...@@ -1128,6 +1150,7 @@ static void End( input_thread_t * p_input )
vlc_object_release( p_pl ); vlc_object_release( p_pl );
} }
#undef CL_CO
/* Tell we're dead */ /* Tell we're dead */
p_input->b_dead = VLC_TRUE; p_input->b_dead = VLC_TRUE;
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/input.h> #include <vlc/input.h>
#include <assert.h>
#include "input_internal.h" #include "input_internal.h"
...@@ -1577,15 +1578,19 @@ static int AReadStream( stream_t *s, void *p_read, int i_read ) ...@@ -1577,15 +1578,19 @@ static int AReadStream( stream_t *s, void *p_read, int i_read )
int i_read_orig = i_read; int i_read_orig = i_read;
int i_total; int i_total;
input_thread_t *p_input = (input_thread_t *)s->p_parent->p_parent ;
assert( p_input );
if( !p_sys->i_list ) if( !p_sys->i_list )
{ {
i_read = p_access->pf_read( p_access, p_read, i_read ); i_read = p_access->pf_read( p_access, p_read, i_read );
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_BYTES, i_read, vlc_mutex_lock( &p_input->counters.counters_lock );
stats_UpdateInteger( s, p_input->counters.p_read_bytes, i_read,
&i_total ); &i_total );
stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE, stats_UpdateFloat( s, p_input->counters.p_input_bitrate,
(float)i_total, NULL ); (float)i_total, NULL );
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1, stats_UpdateInteger( s, p_input->counters.p_read_packets, 1, NULL );
NULL ); vlc_mutex_unlock( &p_input->counters.counters_lock );
return i_read; return i_read;
} }
...@@ -1614,11 +1619,12 @@ static int AReadStream( stream_t *s, void *p_read, int i_read ) ...@@ -1614,11 +1619,12 @@ static int AReadStream( stream_t *s, void *p_read, int i_read )
} }
/* Update read bytes in input */ /* Update read bytes in input */
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_BYTES, i_read, vlc_mutex_lock( &p_input->counters.counters_lock );
&i_total ); stats_UpdateInteger( s, p_input->counters.p_read_bytes, i_read, &i_total );
stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE, stats_UpdateFloat( s, p_input->counters.p_input_bitrate,
(float)i_total, NULL ); (float)i_total, NULL );
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1, NULL ); stats_UpdateInteger( s, p_input->counters.p_read_packets, 1, NULL );
vlc_mutex_unlock( &p_input->counters.counters_lock );
return i_read; return i_read;
} }
...@@ -1630,17 +1636,22 @@ static block_t *AReadBlock( stream_t *s, vlc_bool_t *pb_eof ) ...@@ -1630,17 +1636,22 @@ static block_t *AReadBlock( stream_t *s, vlc_bool_t *pb_eof )
vlc_bool_t b_eof; vlc_bool_t b_eof;
int i_total; int i_total;
input_thread_t *p_input = (input_thread_t *)s->p_parent->p_parent ;
assert( p_input );
if( !p_sys->i_list ) if( !p_sys->i_list )
{ {
p_block = p_access->pf_block( p_access ); p_block = p_access->pf_block( p_access );
if( pb_eof ) *pb_eof = p_access->info.b_eof; if( pb_eof ) *pb_eof = p_access->info.b_eof;
if( p_block && p_access->p_libvlc->b_stats ) if( p_block && p_access->p_libvlc->b_stats )
{ {
stats_UpdateInteger( s->p_parent->p_parent, STATS_READ_BYTES, vlc_mutex_lock( &p_input->counters.counters_lock );
stats_UpdateInteger( s, p_input->counters.p_read_bytes,
p_block->i_buffer, &i_total ); p_block->i_buffer, &i_total );
stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE, stats_UpdateFloat( s, p_input->counters.p_input_bitrate,
(float)i_total, NULL ); (float)i_total, NULL );
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1, NULL ); stats_UpdateInteger( s, p_input->counters.p_read_packets, 1, NULL );
vlc_mutex_unlock( &p_input->counters.counters_lock );
} }
return p_block; return p_block;
} }
...@@ -1671,14 +1682,15 @@ static block_t *AReadBlock( stream_t *s, vlc_bool_t *pb_eof ) ...@@ -1671,14 +1682,15 @@ static block_t *AReadBlock( stream_t *s, vlc_bool_t *pb_eof )
} }
if( p_block ) if( p_block )
{ {
stats_UpdateInteger( s->p_parent->p_parent, STATS_READ_BYTES, vlc_mutex_lock( &p_input->counters.counters_lock );
stats_UpdateInteger( s, p_input->counters.p_read_bytes,
p_block->i_buffer, &i_total ); p_block->i_buffer, &i_total );
stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE, stats_UpdateFloat( s, p_input->counters.p_input_bitrate,
(float)i_total, NULL ); (float)i_total, NULL );
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, stats_UpdateInteger( s, p_input->counters.p_read_packets,
1 , NULL); 1 , NULL);
vlc_mutex_unlock( &p_input->counters.counters_lock );
} }
return p_block; return p_block;
} }
......
...@@ -686,7 +686,9 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -686,7 +686,9 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
} }
libvlc.b_stats = config_GetInt( p_vlc, "stats" ); libvlc.b_stats = config_GetInt( p_vlc, "stats" );
libvlc.p_stats = NULL; libvlc.i_timers = 0;
libvlc.pp_timers = NULL;
vlc_mutex_init( p_vlc, &libvlc.timer_lock );
/* /*
* Initialize hotkey handling * Initialize hotkey handling
...@@ -887,7 +889,6 @@ int VLC_CleanUp( int i_object ) ...@@ -887,7 +889,6 @@ int VLC_CleanUp( int i_object )
vout_thread_t * p_vout; vout_thread_t * p_vout;
aout_instance_t * p_aout; aout_instance_t * p_aout;
announce_handler_t * p_announce; announce_handler_t * p_announce;
stats_handler_t * p_stats;
vlc_t *p_vlc = vlc_current_object( i_object ); vlc_t *p_vlc = vlc_current_object( i_object );
/* Check that the handle is valid */ /* Check that the handle is valid */
...@@ -942,14 +943,8 @@ int VLC_CleanUp( int i_object ) ...@@ -942,14 +943,8 @@ int VLC_CleanUp( int i_object )
aout_Delete( p_aout ); aout_Delete( p_aout );
} }
while( ( p_stats = vlc_object_find( p_vlc, VLC_OBJECT_STATS, FIND_CHILD) ))
{
stats_TimersDumpAll( p_vlc ); stats_TimersDumpAll( p_vlc );
stats_HandlerDestroy( p_stats ); stats_TimersClean( p_vlc );
vlc_object_detach( (vlc_object_t*) p_stats );
vlc_object_release( (vlc_object_t *)p_stats );
// TODO: Delete it
}
/* /*
* Free announce handler(s?) * Free announce handler(s?)
......
...@@ -216,10 +216,6 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type ) ...@@ -216,10 +216,6 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
i_size = sizeof( osd_menu_t ); i_size = sizeof( osd_menu_t );
psz_type = "osd menu"; psz_type = "osd menu";
break; break;
case VLC_OBJECT_STATS:
i_size = sizeof( stats_handler_t );
psz_type = "statistics";
break;
default: default:
i_size = i_type > (int)sizeof(vlc_object_t) i_size = i_type > (int)sizeof(vlc_object_t)
? i_type : (int)sizeof(vlc_object_t); ? i_type : (int)sizeof(vlc_object_t);
......
This diff is collapsed.
...@@ -1942,9 +1942,9 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -1942,9 +1942,9 @@ static void httpd_HostThread( httpd_host_t *host )
{ {
tls_session_t *p_tls = NULL; tls_session_t *p_tls = NULL;
stats_Create( host, "client_connections", STATS_CLIENT_CONNECTIONS, host->p_total_counter = stats_CounterCreate( host,
VLC_VAR_INTEGER, STATS_COUNTER ); VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( host, "active_connections", STATS_ACTIVE_CONNECTIONS, host->p_active_counter = stats_CounterCreate( host,
VLC_VAR_INTEGER, STATS_COUNTER ); VLC_VAR_INTEGER, STATS_COUNTER );
while( !host->b_die ) while( !host->b_die )
...@@ -1995,7 +1995,7 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -1995,7 +1995,7 @@ static void httpd_HostThread( httpd_host_t *host )
cl->i_activity_date+cl->i_activity_timeout < mdate()) ) ) ) cl->i_activity_date+cl->i_activity_timeout < mdate()) ) ) )
{ {
httpd_ClientClean( cl ); httpd_ClientClean( cl );
stats_UpdateInteger( host, STATS_ACTIVE_CONNECTIONS, -1, NULL ); stats_UpdateInteger( host, host->p_active_counter, -1, NULL );
TAB_REMOVE( host->i_client, host->client, cl ); TAB_REMOVE( host->i_client, host->client, cl );
free( cl ); free( cl );
i_client--; i_client--;
...@@ -2490,10 +2490,10 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -2490,10 +2490,10 @@ static void httpd_HostThread( httpd_host_t *host )
{ {
httpd_client_t *cl; httpd_client_t *cl;
char ip[NI_MAXNUMERICHOST]; char ip[NI_MAXNUMERICHOST];
stats_UpdateInteger( host, STATS_CLIENT_CONNECTIONS, stats_UpdateInteger( host, host->p_total_counter,
1, NULL );
stats_UpdateInteger( host, host->p_active_counter,
1, NULL ); 1, NULL );
stats_UpdateInteger( host, STATS_ACTIVE_CONNECTIONS, 1,
NULL );
cl = httpd_ClientNew( fd, &sock, i_sock_size, p_tls ); cl = httpd_ClientNew( fd, &sock, i_sock_size, p_tls );
httpd_ClientIP( cl, ip ); httpd_ClientIP( cl, ip );
msg_Dbg( host, "Connection from %s", ip ); msg_Dbg( host, "Connection from %s", ip );
......
...@@ -80,7 +80,6 @@ int playlist_Control( playlist_t * p_playlist, int i_query, ... ) ...@@ -80,7 +80,6 @@ int playlist_Control( playlist_t * p_playlist, int i_query, ... )
int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args ) int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args )
{ {
int i_view;
playlist_item_t *p_item, *p_node; playlist_item_t *p_item, *p_node;
vlc_value_t val; vlc_value_t val;
......
...@@ -188,7 +188,7 @@ static void EndPlaylist( playlist_t *p_playlist ) ...@@ -188,7 +188,7 @@ static void EndPlaylist( playlist_t *p_playlist )
*****************************************************************************/ *****************************************************************************/
static void RunPreparse ( playlist_preparse_t *p_obj ) static void RunPreparse ( playlist_preparse_t *p_obj )
{ {
playlist_t *p_playlist = p_obj->p_parent; playlist_t *p_playlist = (playlist_t *)p_obj->p_parent;
/* Tell above that we're ready */ /* Tell above that we're ready */
vlc_thread_ready( p_obj ); vlc_thread_ready( p_obj );
......
...@@ -72,7 +72,6 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest ) ...@@ -72,7 +72,6 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest )
{ {
sout_instance_t *p_sout; sout_instance_t *p_sout;
vlc_value_t keep; vlc_value_t keep;
counter_t *p_counter;
if( var_Get( p_parent, "sout-keep", &keep ) < 0 ) if( var_Get( p_parent, "sout-keep", &keep ) < 0 )
{ {
...@@ -142,17 +141,6 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest ) ...@@ -142,17 +141,6 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest )
/* attach it for inherit */ /* attach it for inherit */
vlc_object_attach( p_sout, p_parent ); vlc_object_attach( p_sout, p_parent );
/* Create statistics */
stats_Create( p_parent, "sout_sent_packets", STATS_SOUT_SENT_PACKETS,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_parent, "sout_sent_bytes", STATS_SOUT_SENT_BYTES,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_parent, "sout_send_bitrate", STATS_SOUT_SEND_BITRATE,
VLC_VAR_FLOAT, STATS_DERIVATIVE );
p_counter = stats_CounterGet( p_parent, p_parent->i_object_id,
STATS_SOUT_SEND_BITRATE );
if( p_counter) p_counter->update_interval = 1000000;
p_sout->p_stream = sout_StreamNew( p_sout, p_sout->psz_chain ); p_sout->p_stream = sout_StreamNew( p_sout, p_sout->psz_chain );
if( p_sout->p_stream == NULL ) if( p_sout->p_stream == NULL )
...@@ -383,11 +371,12 @@ int sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer ) ...@@ -383,11 +371,12 @@ int sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer )
FIND_PARENT ); FIND_PARENT );
if( p_input ) if( p_input )
{ {
stats_UpdateInteger( p_input, STATS_SOUT_SENT_PACKETS, 30, NULL ); stats_UpdateInteger( p_input, p_input->counters.p_sout_sent_packets,
stats_UpdateInteger( p_input, STATS_SOUT_SENT_BYTES, 30, NULL );
stats_UpdateInteger( p_input, p_input->counters.p_sout_sent_bytes,
p_access->i_sent_bytes, &i_total ); p_access->i_sent_bytes, &i_total );
stats_UpdateFloat( p_input, STATS_SOUT_SEND_BITRATE, (float)i_total, stats_UpdateFloat( p_input, p_input->counters.p_sout_send_bitrate,
NULL ); (float)i_total, NULL );
p_access->i_sent_bytes = 0; p_access->i_sent_bytes = 0;
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
......
...@@ -229,11 +229,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) ...@@ -229,11 +229,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
return NULL; return NULL;
} }
stats_Create( p_vout, "displayed_pictures",STATS_DISPLAYED_PICTURES,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_vout, "lost_pictures", STATS_LOST_PICTURES,
VLC_VAR_INTEGER, STATS_COUNTER );
/* Initialize pictures - translation tables and functions /* Initialize pictures - translation tables and functions
* will be initialized later in InitThread */ * will be initialized later in InitThread */
for( i_index = 0; i_index < 2 * VOUT_MAX_PICTURES + 1; i_index++) for( i_index = 0; i_index < 2 * VOUT_MAX_PICTURES + 1; i_index++)
...@@ -701,6 +696,8 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -701,6 +696,8 @@ static void RunThread( vout_thread_t *p_vout)
subpicture_t * p_subpic = NULL; /* subpicture pointer */ subpicture_t * p_subpic = NULL; /* subpicture pointer */
input_thread_t *p_input = NULL ; /* Parent input, if it exists */
vlc_value_t val; vlc_value_t val;
vlc_bool_t b_drop_late; vlc_bool_t b_drop_late;
...@@ -723,6 +720,8 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -723,6 +720,8 @@ static void RunThread( vout_thread_t *p_vout)
return; return;
} }
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
/* /*
* Main loop - it is not executed if an error occurred during * Main loop - it is not executed if an error occurred during
* initialization * initialization
...@@ -820,7 +819,10 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -820,7 +819,10 @@ static void RunThread( vout_thread_t *p_vout)
} }
msg_Warn( p_vout, "late picture skipped ("I64Fd")", msg_Warn( p_vout, "late picture skipped ("I64Fd")",
current_date - display_date ); current_date - display_date );
stats_UpdateInteger( p_vout, STATS_LOST_PICTURES, 1 , NULL); vlc_mutex_lock( &p_input->counters.counters_lock );
stats_UpdateInteger( p_vout, p_input->counters.p_lost_pictures,
1 , NULL);
vlc_mutex_unlock( &p_input->counters.counters_lock );
vlc_mutex_unlock( &p_vout->picture_lock ); vlc_mutex_unlock( &p_vout->picture_lock );
continue; continue;
...@@ -843,7 +845,10 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -843,7 +845,10 @@ static void RunThread( vout_thread_t *p_vout)
p_picture->i_status = DESTROYED_PICTURE; p_picture->i_status = DESTROYED_PICTURE;
p_vout->i_heap_size--; p_vout->i_heap_size--;
} }
stats_UpdateInteger( p_vout, STATS_LOST_PICTURES, 1, NULL ); vlc_mutex_lock( &p_input->counters.counters_lock );
stats_UpdateInteger( p_vout, p_input->counters.p_lost_pictures,
1 , NULL);
vlc_mutex_unlock( &p_input->counters.counters_lock );
msg_Warn( p_vout, "vout warning: early picture skipped " msg_Warn( p_vout, "vout warning: early picture skipped "
"("I64Fd")", display_date - current_date "("I64Fd")", display_date - current_date
- p_vout->i_pts_delay ); - p_vout->i_pts_delay );
...@@ -901,7 +906,10 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -901,7 +906,10 @@ static void RunThread( vout_thread_t *p_vout)
/* /*
* Perform rendering * Perform rendering
*/ */
stats_UpdateInteger( p_vout, STATS_DISPLAYED_PICTURES, 1, NULL ); vlc_mutex_lock( &p_input->counters.counters_lock );
stats_UpdateInteger( p_vout, p_input->counters.p_displayed_pictures,
1 , NULL);
vlc_mutex_unlock( &p_input->counters.counters_lock );
p_directbuffer = vout_RenderPicture( p_vout, p_picture, p_subpic ); p_directbuffer = vout_RenderPicture( p_vout, p_picture, p_subpic );
/* /*
......
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