STATS_MAX,
STATS_MIN,
STATS_DERIVATIVE,
- STATS_TIMER
};
struct counter_sample_t
STATS_SOUT_SEND_BITRATE,
STATS_DISPLAYED_PICTURES,
STATS_LOST_PICTURES,
-
- STATS_TIMER_PLAYLIST_BUILD,
- STATS_TIMER_ML_LOAD,
- STATS_TIMER_ML_DUMP,
- STATS_TIMER_INTERACTION,
- STATS_TIMER_PREPARSE,
- STATS_TIMER_INPUT_LAUNCHING,
- STATS_TIMER_MODULE_NEED,
- STATS_TIMER_VIDEO_FRAME_ENCODING,
- STATS_TIMER_AUDIO_FRAME_ENCODING,
-
- STATS_TIMER_SKINS_PLAYTREE_IMAGE,
};
-/*********
- * Timing
- ********/
-VLC_API void stats_TimerStart(vlc_object_t*, const char *, unsigned int );
-VLC_API void stats_TimerStop(vlc_object_t*, unsigned int);
-VLC_API void stats_TimerDump(vlc_object_t*, unsigned int);
-VLC_API void stats_TimersDumpAll(vlc_object_t*);
-#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) )
-
-VLC_API void stats_TimersCleanAll(vlc_object_t * );
-#define stats_TimersCleanAll(a) stats_TimersCleanAll( VLC_OBJECT(a) )
-
-VLC_API void stats_TimerClean(vlc_object_t *, unsigned int );
-#define stats_TimerClean(a,b) stats_TimerClean( VLC_OBJECT(a), b )
-
/**
* @}
*/
void CtrlTree::makeImage()
{
- stats_TimerStart( getIntf(), "[Skins] Playlist image",
- STATS_TIMER_SKINS_PLAYTREE_IMAGE );
delete m_pImage;
// Get the size of the control
const Position *pPos = getPosition();
if( !pPos )
- {
- stats_TimerStop( getIntf(), STATS_TIMER_SKINS_PLAYTREE_IMAGE );
return;
- }
int width = pPos->getWidth();
int height = pPos->getHeight();
m_rFont.drawString( *pStr, color, width-bitmapWidth*depth );
if( !pText )
{
- stats_TimerStop( getIntf(), STATS_TIMER_SKINS_PLAYTREE_IMAGE );
return;
}
if( it->size() )
delete pText;
}
}
- stats_TimerStop( getIntf(), STATS_TIMER_SKINS_PLAYTREE_IMAGE );
}
CtrlTree::Iterator CtrlTree::findItemAtPos( int pos )
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
};
-static inline void audio_timer_start( encoder_t * p_encoder )
-{
- stats_TimerStart( p_encoder, "encoding audio frame",
- STATS_TIMER_AUDIO_FRAME_ENCODING );
-}
-
-static inline void audio_timer_stop( encoder_t * p_encoder )
-{
- stats_TimerStop( p_encoder, STATS_TIMER_AUDIO_FRAME_ENCODING );
-}
-
-static inline void audio_timer_close( encoder_t * p_encoder )
-{
- stats_TimerDump( p_encoder, STATS_TIMER_AUDIO_FRAME_ENCODING );
- stats_TimerClean( p_encoder, STATS_TIMER_AUDIO_FRAME_ENCODING );
-}
-
static aout_buffer_t *audio_new_buffer( decoder_t *p_dec, int i_samples )
{
block_t *p_block;
void transcode_audio_close( sout_stream_id_t *id )
{
- audio_timer_close( id->p_encoder );
-
/* Close decoder */
if( id->p_decoder->p_module )
module_unneed( id->p_decoder, id->p_decoder->p_module );
p_audio_buf->i_dts = p_audio_buf->i_pts;
- audio_timer_start( id->p_encoder );
p_block = id->p_encoder->pf_encode_audio( id->p_encoder, p_audio_buf );
- audio_timer_stop( id->p_encoder );
block_ChainAppend( out, p_block );
block_Release( p_audio_buf );
sout_stream_sys_t *p_sys;
};
-static inline void video_timer_start( encoder_t * p_encoder )
-{
- stats_TimerStart( p_encoder, "encoding video frame",
- STATS_TIMER_VIDEO_FRAME_ENCODING );
-}
-
-static inline void video_timer_stop( encoder_t * p_encoder )
-{
- stats_TimerStop( p_encoder, STATS_TIMER_VIDEO_FRAME_ENCODING );
-}
-
-static inline void video_timer_close( encoder_t * p_encoder )
-{
- stats_TimerDump( p_encoder, STATS_TIMER_VIDEO_FRAME_ENCODING );
- stats_TimerClean( p_encoder, STATS_TIMER_VIDEO_FRAME_ENCODING );
-}
-
static void video_del_buffer_decoder( decoder_t *p_decoder, picture_t *p_pic )
{
VLC_UNUSED(p_decoder);
p_sys->i_first_pic %= PICTURE_RING_SIZE;
vlc_mutex_unlock( &p_sys->lock_out );
- video_timer_start( id->p_encoder );
p_block = id->p_encoder->pf_encode_video( id->p_encoder, p_pic );
- video_timer_stop( id->p_encoder );
vlc_mutex_lock( &p_sys->lock_out );
block_ChainAppend( &p_sys->p_buffers, p_block );
vlc_cond_destroy( &p_stream->p_sys->cond );
}
- video_timer_close( id->p_encoder );
-
/* Close decoder */
if( id->p_decoder->p_module )
module_unneed( id->p_decoder, id->p_decoder->p_module );
{
block_t *p_block;
do {
- video_timer_start( id->p_encoder );
p_block = id->p_encoder->pf_encode_video(id->p_encoder, NULL );
- video_timer_stop( id->p_encoder );
block_ChainAppend( out, p_block );
} while( p_block );
}
{
block_t *p_block;
- video_timer_start( id->p_encoder );
p_block = id->p_encoder->pf_encode_video( id->p_encoder, p_pic );
- video_timer_stop( id->p_encoder );
-
block_ChainAppend( out, p_block );
}
{
block_t *p_block;
p_pic->date = i_pts;
- video_timer_start( id->p_encoder );
p_block = id->p_encoder->pf_encode_video(id->p_encoder, p_pic);
- video_timer_stop( id->p_encoder );
block_ChainAppend( out, p_block );
}
}
free( psz_name );
- /* Start a timer to mesure how long it takes
- * to launch an input */
- stats_TimerStart( p_input, psz_timer_name,
- STATS_TIMER_INPUT_LAUNCHING );
-
p_input->p = calloc( 1, sizeof( input_thread_private_t ) );
if( !p_input->p )
return NULL;
free( psz_name );
#endif
- stats_TimerDump( p_input, STATS_TIMER_INPUT_LAUNCHING );
- stats_TimerClean( p_input, STATS_TIMER_INPUT_LAUNCHING );
-
if( p_input->p->p_es_out_display )
es_out_Delete( p_input->p->p_es_out_display );
bool b_pause_after_eof = b_interactive &&
var_CreateGetBool( p_input, "play-and-pause" );
- /* Start the timer */
- stats_TimerStop( p_input, STATS_TIMER_INPUT_LAUNCHING );
-
while( vlc_object_alive( p_input ) && !p_input->b_error )
{
bool b_force_update;
/* Free playlist now, all threads are gone */
playlist_Destroy( p_playlist );
- stats_TimersDumpAll( p_libvlc );
- stats_TimersCleanAll( p_libvlc );
msg_Dbg( p_libvlc, "removing stats" );
spu_ClearChannel
sql_Create
sql_Destroy
-stats_TimerClean
-stats_TimerDump
-stats_TimersCleanAll
-stats_TimersDumpAll
-stats_TimerStart
-stats_TimerStop
stream_Block
stream_Control
stream_Delete
static int CounterUpdate( vlc_object_t *p_this,
counter_t *p_counter,
vlc_value_t val, vlc_value_t * );
-static void TimerDump( vlc_object_t *p_this, counter_t *p_counter, bool);
/*****************************************************************************
* Exported functions
vlc_mutex_unlock( &p_stats->lock );
}
-#undef stats_TimerStart
-void stats_TimerStart( vlc_object_t *p_obj, const char *psz_name,
- unsigned int i_id )
-{
- libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
- counter_t *p_counter = NULL;
-
- if( !priv->b_stats ) return;
-
- vlc_mutex_lock( &priv->timer_lock );
-
- for( int i = 0 ; i < priv->i_timers; i++ )
- {
- if( priv->pp_timers[i]->i_id == i_id
- && priv->pp_timers[i]->p_obj == p_obj )
- {
- p_counter = priv->pp_timers[i];
- break;
- }
- }
- if( !p_counter )
- {
- counter_sample_t *p_sample;
- p_counter = stats_CounterCreate( VLC_OBJECT(p_obj->p_libvlc),
- VLC_VAR_TIME, STATS_TIMER );
- if( !p_counter )
- goto out;
- p_counter->psz_name = strdup( psz_name );
- p_counter->i_id = i_id;
- p_counter->p_obj = p_obj;
- INSERT_ELEM( priv->pp_timers, priv->i_timers,
- priv->i_timers, p_counter );
-
- /* 1st sample : if started: start_date, else last_time, b_started */
- p_sample = (counter_sample_t *)malloc( sizeof( counter_sample_t ) );
- INSERT_ELEM( p_counter->pp_samples, p_counter->i_samples,
- p_counter->i_samples, p_sample );
- p_sample->date = 0; p_sample->value.b_bool = 0;
- /* 2nd sample : global_time, i_samples */
- p_sample = (counter_sample_t *)malloc( sizeof( counter_sample_t ) );
- INSERT_ELEM( p_counter->pp_samples, p_counter->i_samples,
- p_counter->i_samples, p_sample );
- p_sample->date = 0; p_sample->value.i_int = 0;
- }
- if( p_counter->pp_samples[0]->value.b_bool )
- {
- msg_Warn( p_obj, "timer '%s' was already started !", psz_name );
- goto out;
- }
- p_counter->pp_samples[0]->value.b_bool = true;
- p_counter->pp_samples[0]->date = mdate();
-out:
- vlc_mutex_unlock( &priv->timer_lock );
-}
-
-#undef stats_TimerStop
-void stats_TimerStop( vlc_object_t *p_obj, unsigned int i_id )
-{
- counter_t *p_counter = NULL;
- libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
-
- if( !priv->b_stats ) return;
- vlc_mutex_lock( &priv->timer_lock );
- for( int i = 0 ; i < priv->i_timers; i++ )
- {
- if( priv->pp_timers[i]->i_id == i_id
- && priv->pp_timers[i]->p_obj == p_obj )
- {
- p_counter = priv->pp_timers[i];
- break;
- }
- }
- if( !p_counter || p_counter->i_samples != 2 )
- {
- msg_Err( p_obj, "timer does not exist" );
- goto out;
- }
- p_counter->pp_samples[0]->value.b_bool = false;
- p_counter->pp_samples[1]->value.i_int += 1;
- p_counter->pp_samples[0]->date = mdate() - p_counter->pp_samples[0]->date;
- p_counter->pp_samples[1]->date += p_counter->pp_samples[0]->date;
-out:
- vlc_mutex_unlock( &priv->timer_lock );
-}
-
-#undef stats_TimerDump
-void stats_TimerDump( vlc_object_t *p_obj, unsigned int i_id )
-{
- counter_t *p_counter = NULL;
- libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
-
- if( !priv->b_stats ) return;
- vlc_mutex_lock( &priv->timer_lock );
- for( int i = 0 ; i < priv->i_timers; i++ )
- {
- if( priv->pp_timers[i]->i_id == i_id
- && priv->pp_timers[i]->p_obj == p_obj )
- {
- p_counter = priv->pp_timers[i];
- break;
- }
- }
- TimerDump( p_obj, p_counter, true );
- vlc_mutex_unlock( &priv->timer_lock );
-}
-
-#undef stats_TimersDumpAll
-void stats_TimersDumpAll( vlc_object_t *p_obj )
-{
- libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
-
- if( !priv->b_stats ) return;
- vlc_mutex_lock( &priv->timer_lock );
- for ( int i = 0 ; i < priv->i_timers ; i++ )
- TimerDump( p_obj, priv->pp_timers[i], false );
- vlc_mutex_unlock( &priv->timer_lock );
-}
-
-#undef stats_TimerClean
-void stats_TimerClean( vlc_object_t *p_obj, unsigned int i_id )
-{
- libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
-
- vlc_mutex_lock( &priv->timer_lock );
- for ( int i = priv->i_timers -1 ; i >= 0; i-- )
- {
- counter_t *p_counter = priv->pp_timers[i];
- if( p_counter->i_id == i_id && p_counter->p_obj == p_obj )
- {
- REMOVE_ELEM( priv->pp_timers, priv->i_timers, i );
- stats_CounterClean( p_counter );
- }
- }
- vlc_mutex_unlock( &priv->timer_lock );
-}
-
-#undef stats_TimersCleanAll
-void stats_TimersCleanAll( vlc_object_t *p_obj )
-{
- libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
-
- vlc_mutex_lock( &priv->timer_lock );
- for ( int i = priv->i_timers -1 ; i >= 0; i-- )
- {
- counter_t *p_counter = priv->pp_timers[i];
- REMOVE_ELEM( priv->pp_timers, priv->i_timers, i );
- stats_CounterClean( p_counter );
- }
- vlc_mutex_unlock( &priv->timer_lock );
-}
-
void stats_CounterClean( counter_t *p_c )
{
if( p_c )
}
return VLC_SUCCESS;
}
-
-static void TimerDump( vlc_object_t *p_obj, counter_t *p_counter,
- bool b_total )
-{
- if( !p_counter )
- return;
-
- mtime_t last, total;
- int64_t i_total;
- if( p_counter->i_samples != 2 )
- {
- msg_Err( p_obj, "timer %s does not exist", p_counter->psz_name );
- return;
- }
- i_total = p_counter->pp_samples[1]->value.i_int;
- total = p_counter->pp_samples[1]->date;
- if( p_counter->pp_samples[0]->value.b_bool )
- {
- last = mdate() - p_counter->pp_samples[0]->date;
- i_total += 1;
- total += last;
- }
- else
- {
- last = p_counter->pp_samples[0]->date;
- }
- if( b_total )
- {
- msg_Dbg( p_obj,
- "TIMER %s : %.3f ms - Total %.3f ms / %"PRId64" intvls (Avg %.3f ms)",
- p_counter->psz_name, (float)last/1000, (float)total/1000, i_total,
- (float)(total)/(1000*(float)i_total ) );
- }
- else
- {
- msg_Dbg( p_obj,
- "TIMER %s : Total %.3f ms / %"PRId64" intvls (Avg %.3f ms)",
- p_counter->psz_name, (float)total/1000, i_total,
- (float)(total)/(1000*(float)i_total ) );
- }
-}
const char *psz_name, bool b_strict,
vlc_activate_t probe, ...)
{
- stats_TimerStart( p_this, "module_need()", STATS_TIMER_MODULE_NEED );
-
module_list_t *p_list;
module_t *p_module;
int i_shortcuts = 0;
if( !strcmp( psz_name, "none" ) )
{
free( psz_var );
- stats_TimerStop( p_this, STATS_TIMER_MODULE_NEED );
- stats_TimerDump( p_this, STATS_TIMER_MODULE_NEED );
- stats_TimerClean( p_this, STATS_TIMER_MODULE_NEED );
return NULL;
}
free( psz_shortcuts );
free( psz_var );
- stats_TimerStop( p_this, STATS_TIMER_MODULE_NEED );
- stats_TimerDump( p_this, STATS_TIMER_MODULE_NEED );
- stats_TimerClean( p_this, STATS_TIMER_MODULE_NEED );
-
/* Don't forget that the module is still locked */
return p_module;
}
pl_priv(p_playlist)->b_doing_ml = true;
PL_UNLOCK;
- stats_TimerStart( p_playlist, "ML Load", STATS_TIMER_ML_LOAD );
input_Read( p_playlist, p_input );
- stats_TimerStop( p_playlist,STATS_TIMER_ML_LOAD );
PL_LOCK;
pl_priv(p_playlist)->b_doing_ml = false;
strcat( psz_dirname, DIR_SEP "ml.xspf" );
- stats_TimerStart( p_playlist, "ML Dump", STATS_TIMER_ML_DUMP );
playlist_Export( p_playlist, psz_dirname, p_playlist->p_media_library,
"export-xspf" );
- stats_TimerStop( p_playlist, STATS_TIMER_ML_DUMP );
return VLC_SUCCESS;
}
return;
}
- stats_TimerStart( p_playlist, "Preparse run", STATS_TIMER_PREPARSE );
-
/* Do not preparse if it is already done (like by playing it) */
if( !input_item_IsPreparsed( p_item ) )
{
var_SetAddress( p_playlist, "item-change", p_item );
}
-
- stats_TimerStop( p_playlist, STATS_TIMER_PREPARSE );
}
/**
{
playlist_private_t *p_sys = pl_priv(p_playlist);
- stats_TimerStart( p_playlist, "Items array build",
- STATS_TIMER_PLAYLIST_BUILD );
PL_DEBUG( "rebuilding array of current - root %s",
PLI_NAME( p_sys->status.p_node ) );
ARRAY_RESET( p_playlist->current );
}
}
p_sys->b_reset_currently_playing = false;
- stats_TimerStop( p_playlist, STATS_TIMER_PLAYLIST_BUILD );
}