static stats_handler_t* stats_HandlerCreate( vlc_object_t *p_this );
static stats_handler_t *stats_HandlerGet( vlc_object_t *p_this );
+static void TimerDump( vlc_object_t *p_this, counter_t *p_counter, vlc_bool_t);
+
/*****************************************************************************
* Exported functions
*****************************************************************************/
void __stats_TimerDump( vlc_object_t *p_obj, const char *psz_name )
{
- mtime_t last, total;
- int i_total;
counter_t *p_counter = stats_CounterGet( p_obj,
p_obj->p_vlc->i_object_id,
psz_name );
- if( !p_counter || p_counter->i_samples != 2 )
- {
- msg_Err( p_obj, "timer %s does not exist", 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 == VLC_TRUE )
- {
- last = mdate() - p_counter->pp_samples[0]->date;
- i_total += 1;
- total += last;
- }
- else
- {
- last = p_counter->pp_samples[0]->date;
- }
- msg_Dbg( p_obj, "TIMER %s : %.3f ms - Total %.3f ms / %i intvls (Avg %.3f ms)",
- psz_name, (float)last/1000, (float)total/1000, i_total,
- (float)(total)/(1000*(float)i_total ) );
+ TimerDump( p_obj, p_counter, VLC_TRUE );
}
+
void __stats_TimersDumpAll( vlc_object_t *p_obj )
{
+ int i;
+ stats_handler_t *p_handler = stats_HandlerGet( p_obj );
+ if( !p_handler ) return;
+ vlc_mutex_lock( &p_handler->object_lock );
+ for ( i = 0 ; i< p_handler->i_counters; i++ )
+ {
+ if( p_handler->pp_counters[i]->i_compute_type == STATS_TIMER )
+ {
+ TimerDump( p_obj, p_handler->pp_counters[i], VLC_FALSE );
+ }
+ }
+ vlc_mutex_unlock( &p_handler->object_lock );
}
return p_handler;
}
+
+static void TimerDump( vlc_object_t *p_obj, counter_t *p_counter,
+ vlc_bool_t b_total )
+{
+ mtime_t last, total;
+ int i_total;
+ if( !p_counter || 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 == VLC_TRUE )
+ {
+ 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 / %i 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 / %i intvls (Avg %.3f ms)",
+ p_counter->psz_name, (float)total/1000, i_total,
+ (float)(total)/(1000*(float)i_total ) );
+ }
+}
i_loops++;
if( p_playlist->p_interaction )
{
+ stats_TimerStart( p_playlist, "Interaction thread" );
intf_InteractionManage( p_playlist );
+ stats_TimerStop( p_playlist, "Interaction thread" );
}
vlc_mutex_lock( &p_playlist->object_lock );
{
/* Start another input.
* Get the next item to play */
+ stats_TimerStart( p_playlist, "Playlist walk" );
p_item = NextItem( p_playlist );
+ stats_TimerStop( p_playlist, "Playlist walk" );
/* We must stop */
if( p_item == NULL )
strncmp( p_current->input.psz_uri, "dshow:", 6 ) )
{
b_preparsed = VLC_TRUE;
+ stats_TimerStart( p_playlist, "Preparse run" );
input_Preparse( p_playlist, &p_current->input );
+ stats_TimerStop( p_playlist, "Preparse run" );
}
vlc_mutex_unlock( &p_playlist->object_lock );
if( b_preparsed )
#include <vlc/vlc.h>
#include <vlc/sout.h>
+#include <vlc/input.h>
#include "vlc_meta.h"
{
int i_total;
/* Access_out -> sout_instance -> input_thread_t */
- stats_UpdateInteger( p_access->p_parent->p_parent,
- "sout_sent_packets", 1 );
- stats_UpdateInteger( p_access->p_parent->p_parent,
- "sout_sent_bytes", p_buffer->i_buffer );
- stats_GetInteger( p_access->p_parent->p_parent,
- p_access->p_parent->p_parent->i_object_id,
- "sout_sent_bytes", &i_total );
- stats_UpdateFloat( p_access->p_parent->p_parent, "sout_send_bitrate",
- (float)i_total );
+ input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_access,
+ VLC_OBJECT_INPUT, FIND_PARENT );
+ if( p_input )
+ {
+ stats_UpdateInteger( p_input, "sout_sent_packets", 1 );
+ stats_UpdateInteger( p_input, "sout_sent_bytes", p_buffer->i_buffer );
+ stats_GetInteger( p_input, p_access->p_parent->p_parent->i_object_id,
+ "sout_sent_bytes", &i_total );
+ stats_UpdateFloat( p_input, "sout_send_bitrate", (float)i_total );
+ vlc_object_release( p_input );
+ }
return p_access->pf_write( p_access, p_buffer );
}