Commit 0b44cb99 authored by Clément Stenac's avatar Clément Stenac

Stop using strings to index stats, use integers. The list is not sorted yet, though

parent b41bfdb8
......@@ -228,10 +228,11 @@ struct counter_sample_t
struct counter_t
{
/* The list is *NOT* sorted at the moment, it could be ... */
uint64_t i_index;
char * psz_name;
int i_source_object;
int i_compute_type;
int i_type;
int i_compute_type;
int i_samples;
counter_sample_t ** pp_samples;
......@@ -239,66 +240,93 @@ struct counter_t
mtime_t last_update;
};
enum
{
STATS_INPUT_BITRATE,
STATS_READ_BYTES,
STATS_READ_PACKETS,
STATS_DEMUX_READ,
STATS_DEMUX_BITRATE,
STATS_PLAYED_ABUFFERS,
STATS_LOST_ABUFFERS,
STATS_DECODED_AUDIO,
STATS_DECODED_VIDEO,
STATS_DECODED_SUB,
STATS_CLIENT_CONNECTIONS,
STATS_ACTIVE_CONNECTIONS,
STATS_SOUT_SENT_PACKETS,
STATS_SOUT_SENT_BYTES,
STATS_SOUT_SEND_BITRATE,
STATS_DISPLAYED_PICTURES,
STATS_LOST_PICTURES,
STATS_TIMER_PLAYLIST_WALK,
STATS_TIMER_INTERACTION,
STATS_TIMER_PREPARSE
};
struct stats_handler_t
{
VLC_COMMON_MEMBERS
int i_counters;
hashtable_entry_t * p_counters;
counter_t **pp_counters;
};
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( int, __stats_Update, (vlc_object_t*, const char *, vlc_value_t, vlc_value_t *) );
#define stats_Create( a,b,c,d ) __stats_Create( VLC_OBJECT(a), b, c, d )
VLC_EXPORT( int, __stats_Create, (vlc_object_t*, const char *, int, int) );
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_Create( VLC_OBJECT(a), b, c, d )
VLC_EXPORT( int, __stats_Get, (vlc_object_t*, int, const char *, vlc_value_t*) );
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, const char * ) );
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 )
static inline int __stats_GetInteger( vlc_object_t *p_obj, int i_id,
const char *psz_name, int *value )
unsigned int i_counter, int *value )
{
vlc_value_t val;
int i_ret = __stats_Get( p_obj, i_id, psz_name, &val );
int i_ret = __stats_Get( p_obj, i_id, i_counter, &val );
*value = val.i_int;
return i_ret;
}
#define stats_GetFloat(a,b,c,d ) __stats_GetFloat( VLC_OBJECT(a), b, c, d )
static inline int __stats_GetFloat( vlc_object_t *p_obj, int i_id,
const char *psz_name, float *value )
unsigned int i_counter, float *value )
{
vlc_value_t val;
int i_ret = __stats_Get( p_obj, i_id, psz_name, &val );
int i_ret = __stats_Get( p_obj, i_id, i_counter, &val );
*value = val.f_float;
return i_ret;
}
#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,
const char *psz_name, int i, int *pi_new )
unsigned int i_counter, int i,
int *pi_new )
{
int i_ret;
vlc_value_t val;
vlc_value_t new_val;
val.i_int = i;
i_ret = __stats_Update( p_obj, psz_name, val , &new_val );
i_ret = __stats_Update( p_obj, i_counter, val , &new_val );
if( pi_new )
*pi_new = new_val.i_int;
return i_ret;
}
#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,
const char *psz_name, float f, float *pf_new )
unsigned int i_counter, float f,
float *pf_new )
{
vlc_value_t val;
int i_ret;
vlc_value_t new_val;
val.f_float = f;
i_ret = __stats_Update( p_obj, psz_name, val, &new_val );
i_ret = __stats_Update( p_obj, i_counter, val, &new_val );
if( pf_new )
*pf_new = new_val.f_float;
return i_ret;
......@@ -368,7 +396,7 @@ VLC_EXPORT( void, __stats_ComputeGlobalStats, (vlc_object_t*,global_stats_t*));
* Timing
********/
#ifdef DEBUG
#define stats_TimerStart(a,b) __stats_TimerStart( VLC_OBJECT(a), b )
#define stats_TimerStart(a,b,c) __stats_TimerStart( VLC_OBJECT(a), b,c )
#define stats_TimerStop(a,b) __stats_TimerStop( VLC_OBJECT(a), b )
#define stats_TimerDump(a,b) __stats_TimerDump( VLC_OBJECT(a), b )
#define stats_TimersDumpAll(a) __stats_TimersDumpAll( VLC_OBJECT(a) )
......@@ -378,7 +406,7 @@ VLC_EXPORT( void, __stats_ComputeGlobalStats, (vlc_object_t*,global_stats_t*));
#define stats_TimerDump(a,b) {}
#define stats_TimersDumpAll(a) {}
#endif
VLC_EXPORT( void,__stats_TimerStart, (vlc_object_t*, const char *) );
VLC_EXPORT( void,__stats_TimerStop, (vlc_object_t*, const char *) );
VLC_EXPORT( void,__stats_TimerDump, (vlc_object_t*, const char *) );
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_TimerDump, (vlc_object_t*, unsigned int) );
VLC_EXPORT( void,__stats_TimersDumpAll, (vlc_object_t*) );
......@@ -65,7 +65,7 @@ int playlist_ItemSetName (playlist_item_t *, char *);
void __osd_MenuShow (vlc_object_t *);
httpd_url_t * httpd_UrlNewUnique (httpd_host_t *, const char *psz_url, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl);
void httpd_ClientModeStream (httpd_client_t *cl);
int __stats_Create (vlc_object_t*, const char *, int, int);
int __stats_Create (vlc_object_t*, const char *, unsigned int, int, int);
void httpd_RedirectDelete (httpd_redirect_t *);
void __sout_CfgParse (vlc_object_t *, char *psz_prefix, const char **ppsz_options, sout_cfg_t *);
vlm_media_t * vlm_MediaNew (vlm_t *, const char *, int);
......@@ -124,8 +124,8 @@ void vlm_MessageDelete (vlm_message_t *);
void vout_SynchroDecode (vout_synchro_t *);
int playlist_Delete (playlist_t *, int);
void aout_FiltersPlay (aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_buffer_t ** pp_input_buffer);
int __stats_Update (vlc_object_t*, const char *, vlc_value_t, vlc_value_t *);
int __stats_Get (vlc_object_t*, int, const char *, vlc_value_t*);
int __stats_Update (vlc_object_t*, unsigned int, vlc_value_t, vlc_value_t *);
int __stats_Get (vlc_object_t*, int, int, vlc_value_t*);
char* httpd_ClientIP (httpd_client_t *cl, char *psz_ip);
int __intf_UserProgress (vlc_object_t*, const char*, const char*, float);
void httpd_FileDelete (httpd_file_t *);
......@@ -139,7 +139,7 @@ sout_mux_t * sout_MuxNew (sout_instance_t*, char *, sout_access_out_t *);
stream_t * __stream_DemuxNew (vlc_object_t *p_obj, char *psz_demux, es_out_t *out);
int vout_ShowTextRelative (vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t);
unsigned int update_iterator_Action (update_iterator_t *, int);
void __stats_TimerDump (vlc_object_t*, const char *);
void __stats_TimerDump (vlc_object_t*, unsigned int);
int block_FifoPut (block_fifo_t *, block_t *);
int playlist_ItemAddParent (playlist_item_t *, int,playlist_item_t *);
int __var_Create (vlc_object_t *, const char *, int);
......@@ -151,7 +151,7 @@ int vlc_getnameinfo (const struct sockaddr *, int, char *, int, int *, int);
int vlm_ExecuteCommand (vlm_t *, const char *, vlm_message_t **);
char * config_GetUserDir (void);
httpd_stream_t * httpd_StreamNew (httpd_host_t *, const char *psz_url, const char *psz_mime, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl);
counter_t* __stats_CounterGet (vlc_object_t*, int, const char *);
counter_t* __stats_CounterGet (vlc_object_t*, int, unsigned int);
int __config_GetType (vlc_object_t *, const char *);
void __vlc_thread_ready (vlc_object_t *);
int playlist_Export (playlist_t *, const char *, const char *);
......@@ -206,7 +206,7 @@ int vlm_Save (vlm_t *, const char *);
int ACL_AddNet (vlc_acl_t *p_acl, const char *psz_ip, int i_len, vlc_bool_t b_allow);
void AddMD5 (struct md5_s *, const uint8_t *, uint32_t);
void config_Duplicate (module_t *, module_config_t *);
void __stats_TimerStart (vlc_object_t*, const char *);
void __stats_TimerStart (vlc_object_t*, const char *, int);
block_t * __block_New (vlc_object_t *, int);
void xml_Delete (xml_t *);
void __msg_Warn (vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3);
......@@ -425,7 +425,7 @@ void aout_FormatsPrint (aout_instance_t * p_aout, const char * psz_text, const a
char * FromUTF32 (const wchar_t *);
void __vout_OSDMessage (vlc_object_t *, int, char *, ...);
void intf_StopThread (intf_thread_t *);
void __stats_TimerStop (vlc_object_t*, const char *);
void __stats_TimerStop (vlc_object_t*, unsigned int);
stream_t * __stream_MemoryNew (vlc_object_t *p_obj, uint8_t *p_buffer, int64_t i_size, vlc_bool_t i_preserve_memory);
void mwait (mtime_t date);
void __config_ResetAll (vlc_object_t *);
......@@ -896,23 +896,23 @@ struct module_symbols_t
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_UserHide_inner) (vlc_object_t *, int);
int (*__stats_Create_inner) (vlc_object_t*, const char *, int, int);
int (*__stats_Update_inner) (vlc_object_t*, const char *, vlc_value_t, vlc_value_t *);
int (*__stats_Get_inner) (vlc_object_t*, int, const char *, vlc_value_t*);
int (*__stats_Create_inner) (vlc_object_t*, const char *, unsigned int, int, int);
int (*__stats_Update_inner) (vlc_object_t*, unsigned int, vlc_value_t, vlc_value_t *);
int (*__stats_Get_inner) (vlc_object_t*, int, int, vlc_value_t*);
void (*stats_ComputeInputStats_inner) (input_thread_t*, input_stats_t*);
void (*stats_DumpInputStats_inner) (input_stats_t *);
void (*stats_ReinitInputStats_inner) (input_stats_t *);
counter_t* (*__stats_CounterGet_inner) (vlc_object_t*, int, const char *);
counter_t* (*__stats_CounterGet_inner) (vlc_object_t*, int, unsigned int);
void *__stats_CounterGet_deprecated;
input_thread_t * (*__input_CreateThread2_inner) (vlc_object_t *, input_item_t *, char *);
void (*stats_HandlerDestroy_inner) (stats_handler_t*);
vlc_t * (*vlc_current_object_inner) (int);
void (*__var_OptionParse_inner) (vlc_object_t *, const char *);
void *__stats_TimerDumpAll_deprecated;
void (*__stats_TimerDump_inner) (vlc_object_t*, const char *);
void (*__stats_TimerStart_inner) (vlc_object_t*, const char *);
void (*__stats_TimerDump_inner) (vlc_object_t*, unsigned int);
void (*__stats_TimerStart_inner) (vlc_object_t*, const char *, int);
void (*__stats_ComputeGlobalStats_inner) (vlc_object_t*,global_stats_t*);
void (*__stats_TimerStop_inner) (vlc_object_t*, const char *);
void (*__stats_TimerStop_inner) (vlc_object_t*, unsigned int);
void (*__stats_TimersDumpAll_inner) (vlc_object_t*);
update_iterator_t * (*update_iterator_New_inner) (update_t *);
void (*update_Check_inner) (update_t *, vlc_bool_t);
......
......@@ -1328,7 +1328,8 @@ static int transcode_audio_process( sout_stream_t *p_stream,
while( (p_audio_buf = id->p_decoder->pf_decode_audio( id->p_decoder,
&in )) )
{
stats_UpdateInteger( p_stream->p_parent->p_parent, "decoded_audio", 1, NULL );
stats_UpdateInteger( p_stream->p_parent->p_parent, STATS_DECODED_AUDIO,
1, NULL );
if( p_sys->b_master_sync )
{
mtime_t i_dts = date_Get( &id->interpolated_pts ) + 1;
......@@ -1731,7 +1732,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
while( (p_pic = id->p_decoder->pf_decode_video( id->p_decoder, &in )) )
{
subpicture_t *p_subpic = 0;
stats_UpdateInteger( p_stream->p_parent->p_parent, "decoded_video", 1, NULL );
stats_UpdateInteger( p_stream->p_parent->p_parent, STATS_DECODED_VIDEO,
1, NULL );
if( p_stream->p_sout->i_out_pace_nocontrol && p_sys->b_hurry_up )
{
......
......@@ -312,7 +312,7 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
p_buffer->start_date - mdate());
if( p_input->p_input_thread )
{
stats_UpdateInteger( p_input->p_input_thread, "lost_abuffers", 1,
stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1,
NULL );
}
aout_BufferFree( p_buffer );
......@@ -368,7 +368,7 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
if( p_input->p_input_thread )
{
stats_UpdateInteger( p_input->p_input_thread,
"played_abuffers", 1, NULL );
STATS_PLAYED_ABUFFERS, 1, NULL );
}
vlc_mutex_unlock( &p_aout->mixer_lock );
......
......@@ -447,7 +447,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
start_date = 0;
if( p_input->p_input_thread )
{
stats_UpdateInteger( p_input->p_input_thread, "lost_abuffers", 1,
stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1,
NULL );
}
}
......@@ -460,7 +460,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
mdate() - p_buffer->start_date );
if( p_input->p_input_thread )
{
stats_UpdateInteger( p_input->p_input_thread, "lost_abuffers", 1,
stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1,
NULL );
}
aout_BufferFree( p_buffer );
......@@ -502,7 +502,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_BufferFree( p_buffer );
if( p_input->p_input_thread )
{
stats_UpdateInteger( p_input->p_input_thread, "lost_abuffers", 1,
stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1,
NULL );
}
return 0;
......
......@@ -429,11 +429,11 @@ static decoder_t * CreateDecoder( input_thread_t *p_input,
vlc_object_attach( p_dec, p_input );
stats_Create( p_dec->p_parent, "decoded_audio",
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_Create( p_dec->p_parent, "decoded_video", STATS_DECODED_VIDEO,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_dec->p_parent, "decoded_sub",
stats_Create( p_dec->p_parent, "decoded_sub", STATS_DECODED_SUB,
VLC_VAR_INTEGER, STATS_COUNTER );
/* Find a suitable decoder/packetizer module */
if( i_object_type == VLC_OBJECT_DECODER )
......@@ -627,7 +627,8 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
while( (p_aout_buf = p_dec->pf_decode_audio( p_dec,
&p_packetized_block )) )
{
stats_UpdateInteger( p_dec->p_parent, "decoded_audio", 1, NULL );
stats_UpdateInteger( p_dec->p_parent,
STATS_DECODED_AUDIO, 1, NULL );
/* FIXME the best would be to handle the case start_date < preroll < end_date
* but that's not easy with non raw audio stream */
if( p_dec->p_owner->i_preroll_end > 0 &&
......@@ -651,7 +652,7 @@ 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 )) )
{
stats_UpdateInteger( p_dec->p_parent, "decoded_audio", 1, NULL );
stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_AUDIO, 1, NULL );
if( p_dec->p_owner->i_preroll_end > 0 &&
p_aout_buf->start_date < p_dec->p_owner->i_preroll_end )
{
......@@ -697,7 +698,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
while( (p_pic = p_dec->pf_decode_video( p_dec,
&p_packetized_block )) )
{
stats_UpdateInteger( p_dec->p_parent, "decoded_video",
stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_VIDEO,
1, NULL );
if( p_dec->p_owner->i_preroll_end > 0 &&
p_pic->date < p_dec->p_owner->i_preroll_end )
......@@ -719,7 +720,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
}
else while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) )
{
stats_UpdateInteger( p_dec->p_parent, "decoded_video", 1 , NULL);
stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_VIDEO, 1 , NULL);
if( p_dec->p_owner->i_preroll_end > 0 &&
p_pic->date < p_dec->p_owner->i_preroll_end )
{
......@@ -739,7 +740,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
subpicture_t *p_spu;
while( (p_spu = p_dec->pf_decode_sub( p_dec, &p_block ) ) )
{
stats_UpdateInteger( p_dec->p_parent, "decoded_sub", 1 , NULL);
stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_SUB, 1 , NULL);
if( p_dec->p_owner->i_preroll_end > 0 &&
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 ) )
......
......@@ -1033,9 +1033,9 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
if( p_input->p_libvlc->b_stats )
{
stats_UpdateInteger( p_input, "demux_read", p_block->i_buffer,
stats_UpdateInteger( p_input, STATS_DEMUX_READ, p_block->i_buffer,
&i_total );
stats_UpdateFloat( p_input , "demux_bitrate", (float)i_total, NULL );
stats_UpdateFloat( p_input , STATS_DEMUX_BITRATE, (float)i_total, NULL );
}
/* Mark preroll blocks */
......
......@@ -685,22 +685,28 @@ static int Init( input_thread_t * p_input, vlc_bool_t b_quick )
{
/* Prepare statistics */
counter_t *p_counter;
stats_Create( p_input, "read_bytes", VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "read_packets", VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "demux_read", VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "input_bitrate", VLC_VAR_FLOAT,
STATS_DERIVATIVE );
stats_Create( p_input, "demux_bitrate", VLC_VAR_FLOAT,
STATS_DERIVATIVE );
stats_Create( p_input, "read_bytes", STATS_READ_BYTES,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "read_packets", STATS_READ_PACKETS,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "demux_read", STATS_DEMUX_READ,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "input_bitrate", STATS_INPUT_BITRATE,
VLC_VAR_FLOAT, STATS_DERIVATIVE );
stats_Create( p_input, "demux_bitrate", STATS_DEMUX_BITRATE,
VLC_VAR_FLOAT, STATS_DERIVATIVE );
p_counter = stats_CounterGet( p_input, p_input->i_object_id,
"input_bitrate" );
STATS_INPUT_BITRATE );
if( p_counter ) p_counter->update_interval = 1000000;
p_counter = stats_CounterGet( p_input, p_input->i_object_id,
"demux_bitrate" );
STATS_DEMUX_BITRATE );
if( p_counter ) p_counter->update_interval = 1000000;
stats_Create( p_input, "played_abuffers", VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "lost_abuffers", VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "played_abuffers", STATS_PLAYED_ABUFFERS,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_input, "lost_abuffers", STATS_LOST_ABUFFERS,
VLC_VAR_INTEGER, STATS_COUNTER );
/* handle sout */
psz = var_GetString( p_input, "sout" );
......
......@@ -1580,11 +1580,12 @@ static int AReadStream( stream_t *s, void *p_read, int i_read )
if( !p_sys->i_list )
{
i_read = p_access->pf_read( p_access, p_read, i_read );
stats_UpdateInteger( s->p_parent->p_parent , "read_bytes", i_read,
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_BYTES, i_read,
&i_total );
stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",
stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE,
(float)i_total, NULL );
stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1, NULL );
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1,
NULL );
return i_read;
}
......@@ -1613,11 +1614,11 @@ static int AReadStream( stream_t *s, void *p_read, int i_read )
}
/* Update read bytes in input */
stats_UpdateInteger( s->p_parent->p_parent , "read_bytes", i_read,
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_BYTES, i_read,
&i_total );
stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",
stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE,
(float)i_total, NULL );
stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1, NULL );
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1, NULL );
return i_read;
}
......@@ -1635,11 +1636,11 @@ static block_t *AReadBlock( stream_t *s, vlc_bool_t *pb_eof )
if( pb_eof ) *pb_eof = p_access->info.b_eof;
if( p_block && p_access->p_libvlc->b_stats )
{
stats_UpdateInteger( s->p_parent->p_parent, "read_bytes",
stats_UpdateInteger( s->p_parent->p_parent, STATS_READ_BYTES,
p_block->i_buffer, &i_total );
stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",
stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE,
(float)i_total, NULL );
stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1, NULL );
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1, NULL );
}
return p_block;
}
......@@ -1670,11 +1671,12 @@ static block_t *AReadBlock( stream_t *s, vlc_bool_t *pb_eof )
}
if( p_block )
{
stats_UpdateInteger( s->p_parent->p_parent, "read_bytes",
stats_UpdateInteger( s->p_parent->p_parent, STATS_READ_BYTES,
p_block->i_buffer, &i_total );
stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",
stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE,
(float)i_total, NULL );
stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1 , NULL);
stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS,
1 , NULL);
}
return p_block;
......
This diff is collapsed.
......@@ -2055,8 +2055,10 @@ static void httpd_HostThread( httpd_host_t *host )
{
tls_session_t *p_tls = NULL;
stats_Create( host, "client_connections", VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( host, "active_connections", VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( host, "client_connections", STATS_CLIENT_CONNECTIONS,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( host, "active_connections", STATS_ACTIVE_CONNECTIONS,
VLC_VAR_INTEGER, STATS_COUNTER );
while( !host->b_die )
{
......@@ -2106,7 +2108,7 @@ static void httpd_HostThread( httpd_host_t *host )
cl->i_activity_date+cl->i_activity_timeout < mdate()) ) ) )
{
httpd_ClientClean( cl );
stats_UpdateInteger( host, "active_connections", -1, NULL );
stats_UpdateInteger( host, STATS_ACTIVE_CONNECTIONS, -1, NULL );
TAB_REMOVE( host->i_client, host->client, cl );
free( cl );
i_client--;
......@@ -2560,9 +2562,9 @@ static void httpd_HostThread( httpd_host_t *host )
if( fd >= 0 )
{
httpd_client_t *cl;
stats_UpdateInteger( host, "client_connections", 1,
NULL );
stats_UpdateInteger( host, "active_connections", 1,
stats_UpdateInteger( host, STATS_CLIENT_CONNECTIONS,
1, NULL );
stats_UpdateInteger( host, STATS_ACTIVE_CONNECTIONS, 1,
NULL );
cl = httpd_ClientNew( fd, &sock, i_sock_size, p_tls );
p_tls = NULL;
......
......@@ -598,9 +598,10 @@ static void RunThread ( playlist_t *p_playlist )
i_loops++;
if( p_playlist->p_interaction )
{
stats_TimerStart( p_playlist, "Interaction thread" );
stats_TimerStart( p_playlist, "Interaction thread",
STATS_TIMER_INTERACTION );
intf_InteractionManage( p_playlist );
stats_TimerStop( p_playlist, "Interaction thread" );
stats_TimerStop( p_playlist, STATS_TIMER_INTERACTION );
}
if( i_loops %5 == 0 && p_playlist->p_stats )
......@@ -712,9 +713,10 @@ static void RunThread ( playlist_t *p_playlist )
{
/* Start another input.
* Get the next item to play */
stats_TimerStart( p_playlist, "Playlist walk" );
stats_TimerStart( p_playlist, "Playlist walk",
STATS_TIMER_PLAYLIST_WALK );
p_item = NextItem( p_playlist );
stats_TimerStop( p_playlist, "Playlist walk" );
stats_TimerStop( p_playlist, STATS_TIMER_PLAYLIST_WALK );
/* We must stop */
if( p_item == NULL )
......@@ -876,9 +878,10 @@ static void RunPreparse ( playlist_preparse_t *p_obj )
strncmp( p_current->input.psz_uri, "dshow:", 6 ) )
{
b_preparsed = VLC_TRUE;
stats_TimerStart( p_playlist, "Preparse run" );
stats_TimerStart( p_playlist, "Preparse run",
STATS_TIMER_PREPARSE );
input_Preparse( p_playlist, &p_current->input );
stats_TimerStop( p_playlist, "Preparse run" );
stats_TimerStop( p_playlist, STATS_TIMER_PREPARSE );
}
vlc_mutex_unlock( &p_playlist->object_lock );
if( b_preparsed )
......
......@@ -143,13 +143,14 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest )
vlc_object_attach( p_sout, p_parent );
/* Create statistics */
stats_Create( p_parent, "sout_sent_packets",
stats_Create( p_parent, "sout_sent_packets", STATS_SOUT_SENT_PACKETS,
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_parent, "sout_sent_bytes", VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_parent, "sout_send_bitrate",
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,
"sout_send_bitrate" );
STATS_SOUT_SEND_BITRATE );
if( p_counter) p_counter->update_interval = 1000000;
p_sout->p_stream = sout_StreamNew( p_sout, p_sout->psz_chain );
......@@ -373,7 +374,7 @@ int sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer )
int i_total;
p_access->i_writes++;
p_access->i_sent_bytes += p_buffer->i_buffer;
if( p_access->p_libvlc->b_stats && p_access->i_writes % 10 == 0 )
if( p_access->p_libvlc->b_stats && p_access->i_writes % 30 == 0 )
{
/* Access_out -> sout_instance -> input_thread_t */
input_thread_t *p_input =
......@@ -381,10 +382,10 @@ int sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer )
FIND_PARENT );
if( p_input )
{
stats_UpdateInteger( p_input, "sout_sent_packets", 10, NULL );
stats_UpdateInteger( p_input, "sout_sent_bytes",
stats_UpdateInteger( p_input, STATS_SOUT_SENT_PACKETS, 30, NULL );
stats_UpdateInteger( p_input, STATS_SOUT_SENT_BYTES,
p_access->i_sent_bytes, &i_total );
stats_UpdateFloat( p_input, "sout_send_bitrate", (float)i_total,
stats_UpdateFloat( p_input, STATS_SOUT_SEND_BITRATE, (float)i_total,
NULL );
p_access->i_sent_bytes = 0;
vlc_object_release( p_input );
......
......@@ -229,9 +229,10 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
return NULL;
}
stats_Create( p_vout, "displayed_pictures", VLC_VAR_INTEGER,
STATS_COUNTER );
stats_Create( p_vout, "lost_pictures", VLC_VAR_INTEGER, STATS_COUNTER );
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
* will be initialized later in InitThread */
......@@ -814,7 +815,7 @@ static void RunThread( vout_thread_t *p_vout)
}
msg_Warn( p_vout, "late picture skipped ("I64Fd")",
current_date - display_date );
stats_UpdateInteger( p_vout, "lost_pictures", 1 , NULL);
stats_UpdateInteger( p_vout, STATS_LOST_PICTURES, 1 , NULL);
vlc_mutex_unlock( &p_vout->picture_lock );
continue;
......@@ -837,7 +838,7 @@ static void RunThread( vout_thread_t *p_vout)
p_picture->i_status = DESTROYED_PICTURE;
p_vout->i_heap_size--;
}
stats_UpdateInteger( p_vout, "lost_pictures", 1, NULL );
stats_UpdateInteger( p_vout, STATS_LOST_PICTURES, 1, NULL );
msg_Warn( p_vout, "vout warning: early picture skipped "
"("I64Fd")", display_date - current_date
- p_vout->i_pts_delay );
......@@ -895,7 +896,7 @@ static void RunThread( vout_thread_t *p_vout)
/*
* Perform rendering
*/
stats_UpdateInteger( p_vout, "displayed_pictures", 1, NULL );
stats_UpdateInteger( p_vout, STATS_DISPLAYED_PICTURES, 1, NULL );
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