Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
0b44cb99
Commit
0b44cb99
authored
Feb 04, 2006
by
zorglub
Browse files
Stop using strings to index stats, use integers. The list is not sorted yet, though
parent
b41bfdb8
Changes
14
Hide whitespace changes
Inline
Side-by-side
include/vlc_messages.h
View file @
0b44cb99
...
...
@@ -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
**
p
p_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
*
)
);
include/vlc_symbols.h
View file @
0b44cb99
...
...
@@ -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
);
...
...
modules/stream_out/transcode.c
View file @
0b44cb99
...
...
@@ -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
)
{
...
...
src/audio_output/dec.c
View file @
0b44cb99
...
...
@@ -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
);
...
...
src/audio_output/input.c
View file @
0b44cb99
...
...
@@ -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
;
...
...
src/input/decoder.c
View file @
0b44cb99
...
...
@@ -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
)
)
...
...
src/input/es_out.c
View file @
0b44cb99
...
...
@@ -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 */
...
...
src/input/input.c
View file @
0b44cb99
...
...
@@ -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"
);
...
...
src/input/stream.c
View file @
0b44cb99
...
...
@@ -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
;
...
...
src/misc/stats.c
View file @
0b44cb99
...
...
@@ -33,7 +33,7 @@
* Local prototypes
*****************************************************************************/
static
counter_t
*
GetCounter
(
stats_handler_t
*
p_handler
,
int
i_object_id
,
const
char
*
psz_name
);
unsigned
int
i_counter
);
static
int
stats_CounterUpdate
(
stats_handler_t
*
p_handler
,
counter_t
*
p_counter
,
vlc_value_t
val
,
vlc_value_t
*
);
...
...
@@ -57,8 +57,7 @@ void stats_HandlerDestroy( stats_handler_t *p_stats )
for
(
i
=
p_stats
->
i_counters
-
1
;
i
>=
0
;
i
--
)
{
int
j
;
hashtable_entry_t
p_entry
=
p_stats
->
p_counters
[
i
];
counter_t
*
p_counter
=
p_entry
.
p_data
;
counter_t
*
p_counter
=
p_stats
->
pp_counters
[
i
];
for
(
j
=
p_counter
->
i_samples
-
1
;
j
>=
0
;
j
--
)
{
...
...
@@ -67,8 +66,7 @@ void stats_HandlerDestroy( stats_handler_t *p_stats )
free
(
p_sample
);
}
free
(
p_counter
->
psz_name
);
free
(
p_entry
.
psz_name
);
REMOVE_ELEM
(
p_stats
->
p_counters
,
p_stats
->
i_counters
,
i
);
REMOVE_ELEM
(
p_stats
->
pp_counters
,
p_stats
->
i_counters
,
i
);
free
(
p_counter
);
}
}
...
...
@@ -84,8 +82,8 @@ void stats_HandlerDestroy( stats_handler_t *p_stats )
* STATS_MAX (keep the maximum passed value), STATS_MIN, or STATS_DERIVATIVE
* (keep a time derivative of the value)
*/
int
__stats_Create
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
int
i_
type
,
int
i_compute_type
)
int
__stats_Create
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
unsigned
int
i_
id
,
int
i_type
,
int
i_compute_type
)
{
counter_t
*
p_counter
;
stats_handler_t
*
p_handler
;
...
...
@@ -102,7 +100,7 @@ int __stats_Create( vlc_object_t *p_this, const char *psz_name, int i_type,
p_counter
=
(
counter_t
*
)
malloc
(
sizeof
(
counter_t
)
)
;
p_counter
->
psz_name
=
strdup
(
psz_name
);
p_counter
->
i_
source_object
=
p_this
->
i_object_id
;
p_counter
->
i_
index
=
((
uint64_t
)
p_this
->
i_object_id
<<
32
)
+
i_id
;
p_counter
->
i_compute_type
=
i_compute_type
;
p_counter
->
i_type
=
i_type
;
p_counter
->
i_samples
=
0
;
...
...
@@ -111,8 +109,8 @@ int __stats_Create( vlc_object_t *p_this, const char *psz_name, int i_type,
p_counter
->
update_interval
=
0
;
p_counter
->
last_update
=
0
;
vlc_HashInsert
(
&
p_handler
->
p_counters
,
&
p_handler
->
i_counters
,
p_this
->
i_object_id
,
psz_name
,
p_counter
);
INSERT_ELEM
(
p_handler
->
p
p
_counters
,
p_handler
->
i_counters
,
p_handler
->
i_counters
,
p_counter
);
vlc_mutex_unlock
(
&
p_handler
->
object_lock
);
...
...
@@ -125,7 +123,7 @@ int __stats_Create( vlc_object_t *p_this, const char *psz_name, int i_type,
* \param val the vlc_value union containing the new value to aggregate. For
* more information on how data is aggregated, \see __stats_Create
*/
int
__stats_Update
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
int
__stats_Update
(
vlc_object_t
*
p_this
,
unsigned
int
i_counter
,
vlc_value_t
val
,
vlc_value_t
*
val_new
)
{
int
i_ret
;
...
...
@@ -142,8 +140,7 @@ int __stats_Update( vlc_object_t *p_this, const char *psz_name,
vlc_mutex_lock
(
&
p_handler
->
object_lock
);
/* Look for existing element */
p_counter
=
GetCounter
(
p_handler
,
p_this
->
i_object_id
,
psz_name
);
p_counter
=
GetCounter
(
p_handler
,
p_this
->
i_object_id
,
i_counter
);
if
(
!
p_counter
)
{
vlc_mutex_unlock
(
&
p_handler
->
object_lock
);
...
...
@@ -166,7 +163,7 @@ int __stats_Update( vlc_object_t *p_this, const char *psz_name,
* \return an error code
*/
int
__stats_Get
(
vlc_object_t
*
p_this
,
int
i_object_id
,
const
char
*
psz_name
,
vlc_value_t
*
val
)
unsigned
int
i_counter
,
vlc_value_t
*
val
)
{
counter_t
*
p_counter
;
...
...
@@ -181,8 +178,7 @@ int __stats_Get( vlc_object_t *p_this, int i_object_id,
vlc_mutex_lock
(
&
p_handler
->
object_lock
);
/* Look for existing element */
p_counter
=
GetCounter
(
p_handler
,
i_object_id
,
psz_name
);
p_counter
=
GetCounter
(
p_handler
,
i_object_id
,
i_counter
);
if
(
!
p_counter
)
{
vlc_mutex_unlock
(
&
p_handler
->
object_lock
);
...
...
@@ -245,7 +241,7 @@ int __stats_Get( vlc_object_t *p_this, int i_object_id,
* \return the counter, or NULL if not found (or handler not created yet)
*/
counter_t
*
__stats_CounterGet
(
vlc_object_t
*
p_this
,
int
i_object_id
,
const
char
*
psz_name
)
unsigned
int
i_counter
)
{
counter_t
*
p_counter
;
...
...
@@ -260,8 +256,7 @@ counter_t *__stats_CounterGet( vlc_object_t *p_this, int i_object_id,
vlc_mutex_lock
(
&
p_handler
->
object_lock
);
/* Look for existing element */
p_counter
=
GetCounter
(
p_handler
,
i_object_id
,
psz_name
);
p_counter
=
GetCounter
(
p_handler
,
i_object_id
,
i_counter
);
vlc_mutex_unlock
(
&
p_handler
->
object_lock
);
vlc_object_release
(
p_handler
);
...
...
@@ -278,35 +273,35 @@ void stats_ComputeInputStats( input_thread_t *p_input,
vlc_mutex_lock
(
&
p_stats
->
lock
);
/* Input */
stats_GetInteger
(
p_input
,
p_input
->
i_object_id
,
"read_packets"
,
stats_GetInteger
(
p_input
,
p_input
->
i_object_id
,
STATS_READ_PACKETS
,
&
p_stats
->
i_read_packets
);
stats_GetInteger
(
p_input
,
p_input
->
i_object_id
,
"read_bytes"
,
stats_GetInteger
(
p_input
,
p_input
->
i_object_id
,
STATS_READ_BYTES
,
&
p_stats
->
i_read_bytes
);
stats_GetFloat
(
p_input
,
p_input
->
i_object_id
,
"input_bitrate"
,
stats_GetFloat
(
p_input
,
p_input
->
i_object_id
,
STATS_INPUT_BITRATE
,
&
p_stats
->
f_input_bitrate
);
stats_GetInteger
(
p_input
,
p_input
->
i_object_id
,
"demux_read"
,
stats_GetInteger
(
p_input
,
p_input
->
i_object_id
,
STATS_DEMUX_READ
,
&
p_stats
->
i_demux_read_bytes
);
stats_GetFloat
(
p_input
,
p_input
->
i_object_id
,
"demux_bitrate"
,
stats_GetFloat
(
p_input
,
p_input
->
i_object_id
,
STATS_DEMUX_BITRATE
,