[vlc-devel] commit: input: Set a timer for input launching. (Pierre d'Herbemont )

git version control git at videolan.org
Tue Apr 15 19:39:59 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Tue Apr 15 19:30:29 2008 +0200| [bf117f4d0b399a6add2c0aab756fd9aab9d978e9]

input: Set a timer for input launching.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf117f4d0b399a6add2c0aab756fd9aab9d978e9
---

 include/vlc_messages.h |    1 +
 src/input/input.c      |   21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/include/vlc_messages.h b/include/vlc_messages.h
index aa83521..5da632a 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 7f85afb..ccef8f8 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() ) )




More information about the vlc-devel mailing list