]> git.sesse.net Git - vlc/blobdiff - src/playlist/playlist.c
Compute global input/output stats (Refs:#473)
[vlc] / src / playlist / playlist.c
index bde17ab55b84535e64fa111bea195e1f1b38e67d..751e6f20e2cf14a073c473aec722f3170b96e3bc 100644 (file)
@@ -173,10 +173,12 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
     p_playlist->request.b_request = VLC_FALSE;
     p_playlist->status.i_status = PLAYLIST_STOPPED;
 
-
     p_playlist->i_sort = SORT_ID;
     p_playlist->i_order = ORDER_NORMAL;
 
+    p_playlist->p_stats = (global_stats_t *)malloc( sizeof( global_stats_t ) );
+    vlc_mutex_init( p_playlist, &p_playlist->p_stats->lock );
+
     /* Finally, launch the thread ! */
     if( vlc_thread_create( p_playlist, "playlist", RunThread,
                            VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
@@ -598,6 +600,11 @@ static void RunThread ( playlist_t *p_playlist )
             stats_TimerStop( p_playlist, "Interaction thread" );
         }
 
+        if( i_loops %5 == 0 && p_playlist->p_stats )
+        {
+            stats_ComputeGlobalStats( p_playlist, p_playlist->p_stats );
+        }
+
         vlc_mutex_lock( &p_playlist->object_lock );
 
         /* First, check if we have something to do */