Changeset 0b44cb999e661507876710e271a58b800e7db068
- Timestamp:
- 02/04/06 17:26:23 (3 years ago)
- git-parent:
- Files:
-
- include/vlc_messages.h (modified) (11 diffs)
- include/vlc_symbols.h (modified) (8 diffs)
- modules/stream_out/transcode.c (modified) (2 diffs)
- src/audio_output/dec.c (modified) (2 diffs)
- src/audio_output/input.c (modified) (3 diffs)
- src/input/decoder.c (modified) (6 diffs)
- src/input/es_out.c (modified) (1 diff)
- src/input/input.c (modified) (1 diff)
- src/input/stream.c (modified) (4 diffs)
- src/misc/stats.c (modified) (22 diffs)
- src/network/httpd.c (modified) (3 diffs)
- src/playlist/playlist.c (modified) (3 diffs)
- src/stream_output/stream_output.c (modified) (3 diffs)
- src/video_output/video_output.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc_messages.h
r26d5b73 r0b44cb9 229 229 struct counter_t 230 230 { 231 /* The list is *NOT* sorted at the moment, it could be ... */ 232 uint64_t i_index; 231 233 char * psz_name; 232 int i_ source_object;234 int i_type; 233 235 int i_compute_type; 234 int i_type;235 236 int i_samples; 236 237 counter_sample_t ** pp_samples; … … 240 241 }; 241 242 243 enum 244 { 245 STATS_INPUT_BITRATE, 246 STATS_READ_BYTES, 247 STATS_READ_PACKETS, 248 STATS_DEMUX_READ, 249 STATS_DEMUX_BITRATE, 250 STATS_PLAYED_ABUFFERS, 251 STATS_LOST_ABUFFERS, 252 STATS_DECODED_AUDIO, 253 STATS_DECODED_VIDEO, 254 STATS_DECODED_SUB, 255 STATS_CLIENT_CONNECTIONS, 256 STATS_ACTIVE_CONNECTIONS, 257 STATS_SOUT_SENT_PACKETS, 258 STATS_SOUT_SENT_BYTES, 259 STATS_SOUT_SEND_BITRATE, 260 STATS_DISPLAYED_PICTURES, 261 STATS_LOST_PICTURES, 262 263 STATS_TIMER_PLAYLIST_WALK, 264 STATS_TIMER_INTERACTION, 265 STATS_TIMER_PREPARSE 266 }; 267 242 268 struct stats_handler_t 243 269 { … … 245 271 246 272 int i_counters; 247 hashtable_entry_t *p_counters;273 counter_t **pp_counters; 248 274 }; 249 275 … … 251 277 252 278 #define stats_Update( a,b,c, d) __stats_Update( VLC_OBJECT( a ), b, c, d ) 253 VLC_EXPORT( int, __stats_Update, (vlc_object_t*, const char *, vlc_value_t, vlc_value_t *) );254 #define stats_Create( a,b,c,d ) __stats_Create( VLC_OBJECT(a), b, c, d)255 VLC_EXPORT( int, __stats_Create, (vlc_object_t*, const char *, int, int) );279 VLC_EXPORT( int, __stats_Update, (vlc_object_t*, unsigned int, vlc_value_t, vlc_value_t *) ); 280 #define stats_Create( a,b,c,d,e ) __stats_Create( VLC_OBJECT(a), b, c, d,e ) 281 VLC_EXPORT( int, __stats_Create, (vlc_object_t*, const char *, unsigned int, int, int) ); 256 282 #define stats_Get( a,b,c,d ) __stats_Create( VLC_OBJECT(a), b, c, d ) 257 VLC_EXPORT( int, __stats_Get, (vlc_object_t*, int, const char *, vlc_value_t*) );283 VLC_EXPORT( int, __stats_Get, (vlc_object_t*, int, unsigned int, vlc_value_t*) ); 258 284 #define stats_CounterGet( a,b,c) __stats_CounterGet( VLC_OBJECT(a), b, c ) 259 VLC_EXPORT( counter_t*, __stats_CounterGet, (vlc_object_t*, int, const char *) );285 VLC_EXPORT( counter_t*, __stats_CounterGet, (vlc_object_t*, int, unsigned int ) ); 260 286 261 287 #define stats_GetInteger( a,b,c,d ) __stats_GetInteger( VLC_OBJECT(a), b, c, d ) 262 288 static inline int __stats_GetInteger( vlc_object_t *p_obj, int i_id, 263 const char *psz_name, int *value )289 unsigned int i_counter, int *value ) 264 290 { 265 291 vlc_value_t val; 266 int i_ret = __stats_Get( p_obj, i_id, psz_name, &val );292 int i_ret = __stats_Get( p_obj, i_id, i_counter, &val ); 267 293 *value = val.i_int; 268 294 return i_ret; … … 271 297 #define stats_GetFloat(a,b,c,d ) __stats_GetFloat( VLC_OBJECT(a), b, c, d ) 272 298 static inline int __stats_GetFloat( vlc_object_t *p_obj, int i_id, 273 const char *psz_name, float *value )299 unsigned int i_counter, float *value ) 274 300 { 275 301 vlc_value_t val; 276 int i_ret = __stats_Get( p_obj, i_id, psz_name, &val );302 int i_ret = __stats_Get( p_obj, i_id, i_counter, &val ); 277 303 *value = val.f_float; 278 304 return i_ret; … … 280 306 #define stats_UpdateInteger( a,b,c,d ) __stats_UpdateInteger( VLC_OBJECT(a),b,c,d ) 281 307 static inline int __stats_UpdateInteger( vlc_object_t *p_obj, 282 const char *psz_name, int i, int *pi_new ) 308 unsigned int i_counter, int i, 309 int *pi_new ) 283 310 { 284 311 int i_ret; … … 286 313 vlc_value_t new_val; 287 314 val.i_int = i; 288 i_ret = __stats_Update( p_obj, psz_name, val , &new_val );315 i_ret = __stats_Update( p_obj, i_counter, val , &new_val ); 289 316 if( pi_new ) 290 317 *pi_new = new_val.i_int; … … 293 320 #define stats_UpdateFloat( a,b,c,d ) __stats_UpdateFloat( VLC_OBJECT(a),b,c,d ) 294 321 static inline int __stats_UpdateFloat( vlc_object_t *p_obj, 295 const char *psz_name, float f, float *pf_new ) 322 unsigned int i_counter, float f, 323 float *pf_new ) 296 324 { 297 325 vlc_value_t val; … … 299 327 vlc_value_t new_val; 300 328 val.f_float = f; 301 i_ret = __stats_Update( p_obj, psz_name, val, &new_val );329 i_ret = __stats_Update( p_obj, i_counter, val, &new_val ); 302 330 if( pf_new ) 303 331 *pf_new = new_val.f_float; … … 369 397 ********/ 370 398 #ifdef DEBUG 371 #define stats_TimerStart(a,b ) __stats_TimerStart( VLC_OBJECT(a), b)399 #define stats_TimerStart(a,b,c) __stats_TimerStart( VLC_OBJECT(a), b,c ) 372 400 #define stats_TimerStop(a,b) __stats_TimerStop( VLC_OBJECT(a), b ) 373 401 #define stats_TimerDump(a,b) __stats_TimerDump( VLC_OBJECT(a), b ) … … 379 407 #define stats_TimersDumpAll(a) {} 380 408 #endif 381 VLC_EXPORT( void,__stats_TimerStart, (vlc_object_t*, const char * ) );382 VLC_EXPORT( void,__stats_TimerStop, (vlc_object_t*, const char *) );383 VLC_EXPORT( void,__stats_TimerDump, (vlc_object_t*, const char *) );409 VLC_EXPORT( void,__stats_TimerStart, (vlc_object_t*, const char *, unsigned int ) ); 410 VLC_EXPORT( void,__stats_TimerStop, (vlc_object_t*, unsigned int) ); 411 VLC_EXPORT( void,__stats_TimerDump, (vlc_object_t*, unsigned int) ); 384 412 VLC_EXPORT( void,__stats_TimersDumpAll, (vlc_object_t*) ); include/vlc_symbols.h
r26d5b73 r0b44cb9 66 66 httpd_url_t * httpd_UrlNewUnique (httpd_host_t *, const char *psz_url, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl); 67 67 void httpd_ClientModeStream (httpd_client_t *cl); 68 int __stats_Create (vlc_object_t*, const char *, int, int);68 int __stats_Create (vlc_object_t*, const char *, unsigned int, int, int); 69 69 void httpd_RedirectDelete (httpd_redirect_t *); 70 70 void __sout_CfgParse (vlc_object_t *, char *psz_prefix, const char **ppsz_options, sout_cfg_t *); … … 125 125 int playlist_Delete (playlist_t *, int); 126 126 void aout_FiltersPlay (aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_buffer_t ** pp_input_buffer); 127 int __stats_Update (vlc_object_t*, const char *, vlc_value_t, vlc_value_t *);128 int __stats_Get (vlc_object_t*, int, const char *, vlc_value_t*);127 int __stats_Update (vlc_object_t*, unsigned int, vlc_value_t, vlc_value_t *); 128 int __stats_Get (vlc_object_t*, int, int, vlc_value_t*); 129 129 char* httpd_ClientIP (httpd_client_t *cl, char *psz_ip); 130 130 int __intf_UserProgress (vlc_object_t*, const char*, const char*, float); … … 140 140 int vout_ShowTextRelative (vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t); 141 141 unsigned int update_iterator_Action (update_iterator_t *, int); 142 void __stats_TimerDump (vlc_object_t*, const char *);142 void __stats_TimerDump (vlc_object_t*, unsigned int); 143 143 int block_FifoPut (block_fifo_t *, block_t *); 144 144 int playlist_ItemAddParent (playlist_item_t *, int,playlist_item_t *); … … 152 152 char * config_GetUserDir (void); 153 153 httpd_stream_t * httpd_StreamNew (httpd_host_t *, const char *psz_url, const char *psz_mime, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl); 154 counter_t* __stats_CounterGet (vlc_object_t*, int, const char *);154 counter_t* __stats_CounterGet (vlc_object_t*, int, unsigned int); 155 155 int __config_GetType (vlc_object_t *, const char *); 156 156 void __vlc_thread_ready (vlc_object_t *); … … 207 207 void AddMD5 (struct md5_s *, const uint8_t *, uint32_t); 208 208 void config_Duplicate (module_t *, module_config_t *); 209 void __stats_TimerStart (vlc_object_t*, const char * );209 void __stats_TimerStart (vlc_object_t*, const char *, int); 210 210 block_t * __block_New (vlc_object_t *, int); 211 211 void xml_Delete (xml_t *); … … 426 426 void __vout_OSDMessage (vlc_object_t *, int, char *, ...); 427 427 void intf_StopThread (intf_thread_t *); 428 void __stats_TimerStop (vlc_object_t*, const char *);428 void __stats_TimerStop (vlc_object_t*, unsigned int); 429 429 stream_t * __stream_MemoryNew (vlc_object_t *p_obj, uint8_t *p_buffer, int64_t i_size, vlc_bool_t i_preserve_memory); 430 430 void mwait (mtime_t date); … … 897 897 void (*__intf_UserProgressUpdate_inner) (vlc_object_t*, int, const char*, float); 898 898 void (*__intf_UserHide_inner) (vlc_object_t *, int); 899 int (*__stats_Create_inner) (vlc_object_t*, const char *, int, int);900 int (*__stats_Update_inner) (vlc_object_t*, const char *, vlc_value_t, vlc_value_t *);901 int (*__stats_Get_inner) (vlc_object_t*, int, const char *, vlc_value_t*);899 int (*__stats_Create_inner) (vlc_object_t*, const char *, unsigned int, int, int); 900 int (*__stats_Update_inner) (vlc_object_t*, unsigned int, vlc_value_t, vlc_value_t *); 901 int (*__stats_Get_inner) (vlc_object_t*, int, int, vlc_value_t*); 902 902 void (*stats_ComputeInputStats_inner) (input_thread_t*, input_stats_t*); 903 903 void (*stats_DumpInputStats_inner) (input_stats_t *); 904 904 void (*stats_ReinitInputStats_inner) (input_stats_t *); 905 counter_t* (*__stats_CounterGet_inner) (vlc_object_t*, int, const char *);905 counter_t* (*__stats_CounterGet_inner) (vlc_object_t*, int, unsigned int); 906 906 void *__stats_CounterGet_deprecated; 907 907 input_thread_t * (*__input_CreateThread2_inner) (vlc_object_t *, input_item_t *, char *); … … 910 910 void (*__var_OptionParse_inner) (vlc_object_t *, const char *); 911 911 void *__stats_TimerDumpAll_deprecated; 912 void (*__stats_TimerDump_inner) (vlc_object_t*, const char *);913 void (*__stats_TimerStart_inner) (vlc_object_t*, const char * );912 void (*__stats_TimerDump_inner) (vlc_object_t*, unsigned int); 913 void (*__stats_TimerStart_inner) (vlc_object_t*, const char *, int); 914 914 void (*__stats_ComputeGlobalStats_inner) (vlc_object_t*,global_stats_t*); 915 void (*__stats_TimerStop_inner) (vlc_object_t*, const char *);915 void (*__stats_TimerStop_inner) (vlc_object_t*, unsigned int); 916 916 void (*__stats_TimersDumpAll_inner) (vlc_object_t*); 917 917 update_iterator_t * (*update_iterator_New_inner) (update_t *); modules/stream_out/transcode.c
r26d5b73 r0b44cb9 1329 1329 &in )) ) 1330 1330 { 1331 stats_UpdateInteger( p_stream->p_parent->p_parent, "decoded_audio", 1, NULL ); 1331 stats_UpdateInteger( p_stream->p_parent->p_parent, STATS_DECODED_AUDIO, 1332 1, NULL ); 1332 1333 if( p_sys->b_master_sync ) 1333 1334 { … … 1732 1733 { 1733 1734 subpicture_t *p_subpic = 0; 1734 stats_UpdateInteger( p_stream->p_parent->p_parent, "decoded_video", 1, NULL ); 1735 stats_UpdateInteger( p_stream->p_parent->p_parent, STATS_DECODED_VIDEO, 1736 1, NULL ); 1735 1737 1736 1738 if( p_stream->p_sout->i_out_pace_nocontrol && p_sys->b_hurry_up ) src/audio_output/dec.c
r26d5b73 r0b44cb9 313 313 if( p_input->p_input_thread ) 314 314 { 315 stats_UpdateInteger( p_input->p_input_thread, "lost_abuffers", 1,315 stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1, 316 316 NULL ); 317 317 } … … 369 369 { 370 370 stats_UpdateInteger( p_input->p_input_thread, 371 "played_abuffers", 1, NULL );371 STATS_PLAYED_ABUFFERS, 1, NULL ); 372 372 } 373 373 vlc_mutex_unlock( &p_aout->mixer_lock ); src/audio_output/input.c
r26d5b73 r0b44cb9 448 448 if( p_input->p_input_thread ) 449 449 { 450 stats_UpdateInteger( p_input->p_input_thread, "lost_abuffers", 1,450 stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1, 451 451 NULL ); 452 452 } … … 461 461 if( p_input->p_input_thread ) 462 462 { 463 stats_UpdateInteger( p_input->p_input_thread, "lost_abuffers", 1,463 stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1, 464 464 NULL ); 465 465 } … … 503 503 if( p_input->p_input_thread ) 504 504 { 505 stats_UpdateInteger( p_input->p_input_thread, "lost_abuffers", 1,505 stats_UpdateInteger( p_input->p_input_thread, STATS_LOST_ABUFFERS, 1, 506 506 NULL ); 507 507 } src/input/decoder.c
r26d5b73 r0b44cb9 430 430 vlc_object_attach( p_dec, p_input ); 431 431 432 stats_Create( p_dec->p_parent, "decoded_audio", 432 stats_Create( p_dec->p_parent, "decoded_audio", STATS_DECODED_AUDIO, 433 433 VLC_VAR_INTEGER, STATS_COUNTER ); 434 stats_Create( p_dec->p_parent, "decoded_video", 434 stats_Create( p_dec->p_parent, "decoded_video", STATS_DECODED_VIDEO, 435 435 VLC_VAR_INTEGER, STATS_COUNTER ); 436 stats_Create( p_dec->p_parent, "decoded_sub", 436 stats_Create( p_dec->p_parent, "decoded_sub", STATS_DECODED_SUB, 437 437 VLC_VAR_INTEGER, STATS_COUNTER ); 438 438 /* Find a suitable decoder/packetizer module */ … … 628 628 &p_packetized_block )) ) 629 629 { 630 stats_UpdateInteger( p_dec->p_parent, "decoded_audio", 1, NULL ); 630 stats_UpdateInteger( p_dec->p_parent, 631 STATS_DECODED_AUDIO, 1, NULL ); 631 632 /* FIXME the best would be to handle the case start_date < preroll < end_date 632 633 * but that's not easy with non raw audio stream */ … … 652 653 else while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) ) 653 654 { 654 stats_UpdateInteger( p_dec->p_parent, "decoded_audio", 1, NULL );655 stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_AUDIO, 1, NULL ); 655 656 if( p_dec->p_owner->i_preroll_end > 0 && 656 657 p_aout_buf->start_date < p_dec->p_owner->i_preroll_end ) … … 698 699 &p_packetized_block )) ) 699 700 { 700 stats_UpdateInteger( p_dec->p_parent, "decoded_video",701 stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_VIDEO, 701 702 1, NULL ); 702 703 if( p_dec->p_owner->i_preroll_end > 0 && … … 720 721 else while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) ) 721 722 { 722 stats_UpdateInteger( p_dec->p_parent, "decoded_video", 1 , NULL);723 stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_VIDEO, 1 , NULL); 723 724 if( p_dec->p_owner->i_preroll_end > 0 && 724 725 p_pic->date < p_dec->p_owner->i_preroll_end ) … … 740 741 while( (p_spu = p_dec->pf_decode_sub( p_dec, &p_block ) ) ) 741 742 { 742 stats_UpdateInteger( p_dec->p_parent, "decoded_sub", 1 , NULL);743 stats_UpdateInteger( p_dec->p_parent, STATS_DECODED_SUB, 1 , NULL); 743 744 if( p_dec->p_owner->i_preroll_end > 0 && 744 745 p_spu->i_start < p_dec->p_owner->i_preroll_end && src/input/es_out.c
r26d5b73 r0b44cb9 1034 1034 if( p_input->p_libvlc->b_stats ) 1035 1035 { 1036 stats_UpdateInteger( p_input, "demux_read", p_block->i_buffer,1036 stats_UpdateInteger( p_input, STATS_DEMUX_READ, p_block->i_buffer, 1037 1037 &i_total ); 1038 stats_UpdateFloat( p_input , "demux_bitrate", (float)i_total, NULL );1038 stats_UpdateFloat( p_input , STATS_DEMUX_BITRATE, (float)i_total, NULL ); 1039 1039 } 1040 1040 src/input/input.c
r8eaff12 r0b44cb9 686 686 /* Prepare statistics */ 687 687 counter_t *p_counter; 688 stats_Create( p_input, "read_bytes", VLC_VAR_INTEGER, STATS_COUNTER ); 689 stats_Create( p_input, "read_packets", VLC_VAR_INTEGER, STATS_COUNTER ); 690 stats_Create( p_input, "demux_read", VLC_VAR_INTEGER, STATS_COUNTER ); 691 stats_Create( p_input, "input_bitrate", VLC_VAR_FLOAT, 692 STATS_DERIVATIVE ); 693 stats_Create( p_input, "demux_bitrate", VLC_VAR_FLOAT, 694 STATS_DERIVATIVE ); 688 stats_Create( p_input, "read_bytes", STATS_READ_BYTES, 689 VLC_VAR_INTEGER, STATS_COUNTER ); 690 stats_Create( p_input, "read_packets", STATS_READ_PACKETS, 691 VLC_VAR_INTEGER, STATS_COUNTER ); 692 stats_Create( p_input, "demux_read", STATS_DEMUX_READ, 693 VLC_VAR_INTEGER, STATS_COUNTER ); 694 stats_Create( p_input, "input_bitrate", STATS_INPUT_BITRATE, 695 VLC_VAR_FLOAT, STATS_DERIVATIVE ); 696 stats_Create( p_input, "demux_bitrate", STATS_DEMUX_BITRATE, 697 VLC_VAR_FLOAT, STATS_DERIVATIVE ); 698 695 699 p_counter = stats_CounterGet( p_input, p_input->i_object_id, 696 "input_bitrate");700 STATS_INPUT_BITRATE ); 697 701 if( p_counter ) p_counter->update_interval = 1000000; 698 702 p_counter = stats_CounterGet( p_input, p_input->i_object_id, 699 "demux_bitrate");703 STATS_DEMUX_BITRATE ); 700 704 if( p_counter ) p_counter->update_interval = 1000000; 701 705 702 stats_Create( p_input, "played_abuffers", VLC_VAR_INTEGER, STATS_COUNTER ); 703 stats_Create( p_input, "lost_abuffers", VLC_VAR_INTEGER, STATS_COUNTER ); 706 stats_Create( p_input, "played_abuffers", STATS_PLAYED_ABUFFERS, 707 VLC_VAR_INTEGER, STATS_COUNTER ); 708 stats_Create( p_input, "lost_abuffers", STATS_LOST_ABUFFERS, 709 VLC_VAR_INTEGER, STATS_COUNTER ); 704 710 705 711 /* handle sout */ src/input/stream.c
r26d5b73 r0b44cb9 1581 1581 { 1582 1582 i_read = p_access->pf_read( p_access, p_read, i_read ); 1583 stats_UpdateInteger( s->p_parent->p_parent , "read_bytes", i_read,1583 stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_BYTES, i_read, 1584 1584 &i_total ); 1585 stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",1585 stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE, 1586 1586 (float)i_total, NULL ); 1587 stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1, NULL ); 1587 stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1, 1588 NULL ); 1588 1589 return i_read; 1589 1590 } … … 1614 1615 1615 1616 /* Update read bytes in input */ 1616 stats_UpdateInteger( s->p_parent->p_parent , "read_bytes", i_read,1617 stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_BYTES, i_read, 1617 1618 &i_total ); 1618 stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",1619 stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE, 1619 1620 (float)i_total, NULL ); 1620 stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1, NULL );1621 stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1, NULL ); 1621 1622 return i_read; 1622 1623 } … … 1636 1637 if( p_block && p_access->p_libvlc->b_stats ) 1637 1638 { 1638 stats_UpdateInteger( s->p_parent->p_parent, "read_bytes",1639 stats_UpdateInteger( s->p_parent->p_parent, STATS_READ_BYTES, 1639 1640 p_block->i_buffer, &i_total ); 1640 stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",1641 stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE, 1641 1642 (float)i_total, NULL ); 1642 stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1, NULL );1643 stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1, NULL ); 1643 1644 } 1644 1645 return p_block; … … 1671 1672 if( p_block ) 1672 1673 { 1673 stats_UpdateInteger( s->p_parent->p_parent, "read_bytes",1674 stats_UpdateInteger( s->p_parent->p_parent, STATS_READ_BYTES, 1674 1675 p_block->i_buffer, &i_total ); 1675 stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",1676 stats_UpdateFloat( s->p_parent->p_parent , STATS_INPUT_BITRATE, 1676 1677 (float)i_total, NULL ); 1677 stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1 , NULL); 1678 stats_UpdateInteger( s->p_parent->p_parent , STATS_READ_PACKETS, 1679 1 , NULL); 1678 1680 } 1679 1681 src/misc/stats.c
r26d5b73 r0b44cb9 34 34 *****************************************************************************/ 35 35 static counter_t *GetCounter( stats_handler_t *p_handler, int i_object_id, 36 const char *psz_name);36 unsigned int i_counter ); 37 37 static int stats_CounterUpdate( stats_handler_t *p_handler, 38 38 counter_t *p_counter, … … 58 58 { 59 59 int j; 60 hashtable_entry_t p_entry = p_stats->p_counters[i]; 61 counter_t * p_counter = p_entry.p_data; 60 counter_t *p_counter = p_stats->pp_counters[i]; 62 61 63 62 for( j = p_counter->i_samples -1; j >= 0 ; j-- ) … … 68 67 } 69 68 free( p_counter->psz_name ); 70 free( p_entry.psz_name ); 71 REMOVE_ELEM( p_stats->p_counters, p_stats->i_counters, i ); 69 REMOVE_ELEM( p_stats->pp_counters, p_stats->i_counters, i ); 72 70 free( p_counter ); 73 71 } … … 85 83 * (keep a time derivative of the value) 86 84 */ 87 int __stats_Create( vlc_object_t *p_this, const char *psz_name, int i_type,88 int i_ compute_type )85 int __stats_Create( vlc_object_t *p_this, const char *psz_name, unsigned int i_id, 86 int i_type, int i_compute_type ) 89 87 { 90 88 counter_t *p_counter; … … 103 101 104 102 p_counter->psz_name = strdup( psz_name ); 105 p_counter->i_ source_object = p_this->i_object_id;103 p_counter->i_index = ((uint64_t)p_this->i_object_id << 32 ) + i_id; 106 104 p_counter->i_compute_type = i_compute_type; 107 105 p_counter->i_type = i_type; … … 112 110 p_counter->last_update = 0; 113 111 114 vlc_HashInsert( &p_handler->p_counters, &p_handler->i_counters, p_this->i_object_id,115 psz_name, p_counter );112 INSERT_ELEM( p_handler->pp_counters, p_handler->i_counters, 113 p_handler->i_counters, p_counter ); 116 114 117 115 vlc_mutex_unlock( &p_handler->object_lock ); … … 126 124 * more information on how data is aggregated, \see __stats_Create 127 125 */ 128 int __stats_Update( vlc_object_t *p_this, const char *psz_name,126 int __stats_Update( vlc_object_t *p_this, unsigned int i_counter, 129 127 vlc_value_t val, vlc_value_t *val_new ) 130 128 { … … 143 141 vlc_mutex_lock( &p_handler->object_lock ); 144 142 /* Look for existing element */ 145 p_counter = GetCounter( p_handler, p_this->i_object_id, 146 psz_name ); 143 p_counter = GetCounter( p_handler, p_this->i_object_id, i_counter ); 147 144 if( !p_counter ) 148 145 { … … 167 164 */ 168 165 int __stats_Get( vlc_object_t *p_this, int i_object_id, 169 const char *psz_name, vlc_value_t *val )166 unsigned int i_counter, vlc_value_t *val ) 170 167 { 171 168 counter_t *p_counter; … … 182 179 183 180 /* Look for existing element */ 184 p_counter = GetCounter( p_handler, i_object_id, 185 psz_name ); 181 p_counter = GetCounter( p_handler, i_object_id, i_counter ); 186 182 if( !p_counter ) 187 183 { … … 246 242 */ 247 243 counter_t *__stats_CounterGet( vlc_object_t *p_this, int i_object_id, 248 const char *psz_name)244 unsigned int i_counter ) 249 245 { 250 246 counter_t *p_counter; … … 261 257 262 258 /* Look for existing element */ 263 p_counter = GetCounter( p_handler, i_object_id, 264 psz_name ); 259 p_counter = GetCounter( p_handler, i_object_id, i_counter ); 265 260 vlc_mutex_unlock( &p_handler->object_lock ); 266 261 vlc_object_release( p_handler ); … … 279 274 280 275 /* Input */ 281 stats_GetInteger( p_input, p_input->i_object_id, "read_packets",276 stats_GetInteger( p_input, p_input->i_object_id, STATS_READ_PACKETS, 282 277 &p_stats->i_read_packets ); 283 stats_GetInteger( p_input, p_input->i_object_id, "read_bytes",278 stats_GetInteger( p_input, p_input->i_object_id, STATS_READ_BYTES, 284 279 &p_stats->i_read_bytes ); 285 stats_GetFloat( p_input, p_input->i_object_id, "input_bitrate",280 stats_GetFloat( p_input, p_input->i_object_id, STATS_INPUT_BITRATE, 286 281 &p_stats->f_input_bitrate ); 287 282 288 stats_GetInteger( p_input, p_input->i_object_id, "demux_read",283 stats_GetInteger( p_input, p_input->i_object_id, STATS_DEMUX_READ, 289 284 &p_stats->i_demux_read_bytes ); 290 stats_GetFloat( p_input, p_input->i_object_id, "demux_bitrate",285 stats_GetFloat( p_input, p_input->i_object_id, STATS_DEMUX_BITRATE, 291 286 &p_stats->f_demux_bitrate ); 292 287 293 stats_GetInteger( p_input, p_input->i_object_id, "decoded_video",288 stats_GetInteger( p_input, p_input->i_object_id, STATS_DECODED_VIDEO, 294 289 &p_stats->i_decoded_video ); 295 stats_GetInteger( p_input, p_input->i_object_id, "decoded_audio",290 stats_GetInteger( p_input, p_input->i_object_id, STATS_DECODED_AUDIO, 296 291 &p_stats->i_decoded_audio ); 297 292 298 293 /* Sout */ 299 stats_GetInteger( p_input, p_input->i_object_id, "sout_sent_packets",294 stats_GetInteger( p_input, p_input->i_object_id, STATS_SOUT_SENT_PACKETS, 300 295 &p_stats->i_sent_packets ); 301 stats_GetInteger( p_input, p_input->i_object_id, "sout_sent_bytes",296 stats_GetInteger( p_input, p_input->i_object_id, STATS_SOUT_SENT_BYTES, 302 297 &p_stats->i_sent_bytes ); 303 stats_GetFloat ( p_input, p_input->i_object_id, "sout_send_bitrate",298 stats_GetFloat ( p_input, p_input->i_object_id, STATS_SOUT_SEND_BITRATE, 304 299 &p_stats->f_send_bitrate ); 305 300 306 301 /* Aout - We store in p_input because aout is shared */ 307 stats_GetInteger( p_input, p_input->i_object_id, "played_abuffers",302 stats_GetInteger( p_input, p_input->i_object_id, STATS_PLAYED_ABUFFERS, 308 303 &p_stats->i_played_abuffers ); 309 stats_GetInteger( p_input, p_input->i_object_id, "lost_abuffers",304 stats_GetInteger( p_input, p_input->i_object_id, STATS_LOST_ABUFFERS, 310 305 &p_stats->i_lost_abuffers ); 311 306 … … 320 315 int i_displayed = 0, i_lost = 0; 321 316 p_obj = (vlc_object_t *)p_list->p_values[i_index].p_object; 322 stats_GetInteger( p_obj, p_obj->i_object_id, "displayed_pictures", 317 stats_GetInteger( p_obj, p_obj->i_object_id, 318 STATS_DISPLAYED_PICTURES, 323 319 &i_displayed ); 324 stats_GetInteger( p_obj, p_obj->i_object_id, "lost_pictures",320 stats_GetInteger( p_obj, p_obj->i_object_id, STATS_LOST_PICTURES, 325 321 &i_lost ); 326 322 p_stats->i_displayed_pictures += i_displayed; … … 352 348 /* f_bitrate is in bytes / microsecond 353 349 * *1000 => bytes / millisecond => kbytes / seconds */ 354 fprintf( stderr, "Input : %i (%i bytes) - %f kB/s - Demux : %i (%i bytes) - %f kB/s\n" 355 " - Vout : %i/%i - Aout : %i/%i - Vout : %f\n", 350 fprintf( stderr, "Input : %i (%i bytes) - %f kB/s - " 351 "Demux : %i (%i bytes) - %f kB/s\n" 352 " - Vout : %i/%i - Aout : %i/%i - Sout : %f\n", 356 353 p_stats->i_read_packets, p_stats->i_read_bytes, 357 354 p_stats->f_input_bitrate * 1000, … … 379 376 float f_in = 0, f_out = 0, f_demux = 0; 380 377 p_obj = (vlc_object_t *)p_list->p_values[i_index].p_object; 381 stats_GetFloat( p_obj, p_obj->i_object_id, "input_bitrate",378 stats_GetFloat( p_obj, p_obj->i_object_id, STATS_INPUT_BITRATE, 382 379 &f_in ); 383 stats_GetFloat( p_obj, p_obj->i_object_id, "sout_send_bitrate",380 stats_GetFloat( p_obj, p_obj->i_object_id, STATS_SOUT_SEND_BITRATE, 384 381 &f_out ); 385 stats_GetFloat( p_obj, p_obj->i_object_id, "demux_bitrate",382 stats_GetFloat( p_obj, p_obj->i_object_id, STATS_DEMUX_BITRATE, 386 383 &f_demux ); 387 384 f_total_in += f_in; f_total_out += f_out;f_total_demux += f_demux; … … 402 399 403 400 404 void __stats_TimerStart( vlc_object_t *p_obj, const char *psz_name ) 401 void __stats_TimerStart( vlc_object_t *p_obj, const char *psz_name, 402 unsigned int i_id ) 405 403 { 406 404 counter_t *p_counter = stats_CounterGet( p_obj, 407 p_obj->p_vlc->i_object_id, 408 psz_name ); 405 p_obj->p_vlc->i_object_id, i_id ); 409 406 if( !p_counter ) 410 407 { 411 408 counter_sample_t *p_sample; 412 stats_Create( p_obj->p_vlc, psz_name, VLC_VAR_TIME, STATS_TIMER );409 stats_Create( p_obj->p_vlc, psz_name, i_id, VLC_VAR_TIME, STATS_TIMER ); 413 410 p_counter = stats_CounterGet( p_obj, p_obj->p_vlc->i_object_id, 414 psz_name);411 i_id ); 415 412 if( !p_counter ) return; 416 413 /* 1st sample : if started: start_date, else last_time, b_started */ … … 434 431 } 435 432 436 void __stats_TimerStop( vlc_object_t *p_obj, const char *psz_name)433 void __stats_TimerStop( vlc_object_t *p_obj, unsigned int i_id ) 437 434 { 438 435 counter_t *p_counter = stats_CounterGet( p_obj, 439 p_obj->p_vlc->i_object_id,440 psz_name);436 p_obj->p_vlc->i_object_id, 437 i_id ); 441 438 if( !p_counter || p_counter->i_samples != 2 ) 442 439 { 443 msg_Err( p_obj, "timer %s does not exist", psz_name);440 msg_Err( p_obj, "timer does not exist" ); 444 441 return; 445 442 } … … 450 447 } 451 448 452 void __stats_TimerDump( vlc_object_t *p_obj, const char *psz_name)449 void __stats_TimerDump( vlc_object_t *p_obj, unsigned int i_id ) 453 450 { 454 451 counter_t *p_counter = stats_CounterGet( p_obj, 455 452 p_obj->p_vlc->i_object_id, 456 psz_name);453 i_id ); 457 454 TimerDump( p_obj, p_counter, VLC_TRUE ); 458 455 } … … 468 465 for ( i = 0 ; i< p_handler->i_counters; i++ ) 469 466 { 470 counter_t * p_counter = (counter_t *)(p_handler->p_counters[i].p_data);467 counter_t * p_counter = p_handler->pp_counters[i]; 471 468 if( p_counter->i_compute_type == STATS_TIMER ) 472 469 { … … 618 615 619 616 static counter_t *GetCounter( stats_handler_t *p_handler, int i_object_id, 620 const char *psz_name)617 unsigned int i_counter ) 621 618 { 622 619 int i; 623 return (counter_t *)vlc_HashRetrieve( p_handler->p_counters, p_handler->i_counters, 624 i_object_id, psz_name ); 620 uint64_t i_index = ((uint64_t) i_object_id << 32 ) + i_counter; 621 for (i = 0 ; i < p_handler->i_counters ; i++ ) 622 { 623 if( i_index == p_handler->pp_counters[i]->i_index ) 624 return p_handler->pp_counters[i]; 625 } 626 return NULL; 625 627 } 626 628 … … 662 664 } 663 665 p_handler->i_counters = 0; 664 p_handler->p _counters = (hashtable_entry_t *) malloc( 4 * sizeof( variable_t ) );666 p_handler->pp_counters = NULL; 665 667 666 668 /// \bug is it p_vlc or p_libvlc ? src/network/httpd.c
r26d5b73 r0b44cb9 2056 2056 tls_session_t *p_tls = NULL; 2057 2057 2058 stats_Create( host, "client_connections", VLC_VAR_INTEGER, STATS_COUNTER ); 2059 stats_Create( host, "active_connections", VLC_VAR_INTEGER, STATS_COUNTER ); 2058 stats_Create( host, "client_connections", STATS_CLIENT_CONNECTIONS, 2059 VLC_VAR_INTEGER, STATS_COUNTER ); 2060 stats_Create( host, "active_connections", STATS_ACTIVE_CONNECTIONS, 2061 VLC_VAR_INTEGER, STATS_COUNTER ); 2060 2062 2061 2063 while( !host->b_die ) … … 2107 2109 { 2108 2110 httpd_ClientClean( cl ); 2109 stats_UpdateInteger( host, "active_connections", -1, NULL );2111 stats_UpdateInteger( host, STATS_ACTIVE_CONNECTIONS, -1, NULL ); 2110 2112 TAB_REMOVE( host->i_client, host->client, cl ); 2111 2113 free( cl ); … … 2561 2563 { 2562 2564 httpd_client_t *cl; 2563 stats_UpdateInteger( host, "client_connections", 1,2564 NULL );2565 stats_UpdateInteger( host, "active_connections", 1,2565 stats_UpdateInteger( host, STATS_CLIENT_CONNECTIONS, 2566 1, NULL ); 2567 stats_UpdateInteger( host, STATS_ACTIVE_CONNECTIONS, 1, 2566 2568 NULL ); 2567 2569 cl = httpd_ClientNew( fd, &sock, i_sock_size, p_tls ); src/playlist/playlist.c
rb41bfdb r0b44cb9 599 599 if( p_playlist->p_interaction ) 600 600 { 601 stats_TimerStart( p_playlist, "Interaction thread" ); 601 stats_TimerStart( p_playlist, "Interaction thread", 602 STATS_TIMER_INTERACTION ); 602 603 intf_InteractionManage( p_playlist ); 603 stats_TimerStop( p_playlist, "Interaction thread");604 stats_TimerStop( p_playlist, STATS_TIMER_INTERACTION ); 604 605 } 605 606 … … 713 714 /* Start another input. 714 715 * Get the next item to play */ 715 stats_TimerStart( p_playlist, "Playlist walk" ); 716
