From: Pierre d'Herbemont Date: Tue, 15 Apr 2008 17:30:29 +0000 (+0200) Subject: input: Set a timer for input launching. X-Git-Tag: 0.9.0-test0~1477 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=bf117f4d0b399a6add2c0aab756fd9aab9d978e9;p=vlc input: Set a timer for input launching. --- diff --git a/include/vlc_messages.h b/include/vlc_messages.h index aa835213e0..5da632a5a7 100644 --- a/include/vlc_messages.h +++ b/include/vlc_messages.h @@ -229,6 +229,7 @@ enum STATS_TIMER_ML_DUMP, STATS_TIMER_INTERACTION, STATS_TIMER_PREPARSE, + STATS_TIMER_INPUT_LAUNCHING, STATS_TIMER_SKINS_PLAYTREE_IMAGE, }; diff --git a/src/input/input.c b/src/input/input.c index 7f85afbd5b..ccef8f84f1 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -139,6 +139,19 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, msg_Err( p_parent, "out of memory" ); return NULL; } + + /* Construct a nice name for the input timer */ + char psz_timer_name[255]; + char * psz_name = input_item_GetName( p_item ); + snprintf( psz_timer_name, sizeof(psz_timer_name), + "input launching for '%s'", psz_name ); + 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 ); + MALLOC_NULL( p_input->p, input_thread_private_t ); /* One "randomly" selected input thread is responsible for computing @@ -307,6 +320,9 @@ static void Destructor( input_thread_t * p_input ) { input_thread_private_t *priv = p_input->p; + stats_TimerDump( p_input, STATS_TIMER_INPUT_LAUNCHING ); + stats_TimerClean( p_input, STATS_TIMER_INPUT_LAUNCHING ); + if( priv->b_owns_its_sout && priv->p_sout ) { if( priv->b_sout_keep ) @@ -603,6 +619,9 @@ static void MainLoop( input_thread_t *p_input ) int64_t i_intf_update = 0; int i_updates = 0; + /* Stop the timer */ + stats_TimerStop( p_input, STATS_TIMER_INPUT_LAUNCHING ); + while( !p_input->b_die && !p_input->b_error && !p_input->p->input.b_eof ) { bool b_force_update = false; @@ -611,7 +630,7 @@ static void MainLoop( input_thread_t *p_input ) vlc_value_t val; /* Do the read */ - if( p_input->i_state != PAUSE_S ) + if( p_input->i_state != PAUSE_S ) { if( ( p_input->p->i_stop > 0 && p_input->i_time >= p_input->p->i_stop ) || ( p_input->p->i_run > 0 && i_start_mdate+p_input->p->i_run < mdate() ) )