Changeset 03b059c1b6814784fa731a4687ad45b338fa91e8
- Timestamp:
- 01/08/06 16:48:41
(3 years ago)
- Author:
- Clément Stenac <zorglub@videolan.org>
- git-committer:
- Clément Stenac <zorglub@videolan.org> 1136735321 +0000
- git-parent:
[efacf7b59b10eace643aec90a54f10674e5c4712]
- git-author:
- Clément Stenac <zorglub@videolan.org> 1136735321 +0000
- Message:
Some more stats preliminary work
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| ra5a5d46 |
r03b059c |
|
| 209 | 209 | STATS_MAX, |
|---|
| 210 | 210 | STATS_MIN, |
|---|
| | 211 | STATS_DERIVATIVE |
|---|
| 211 | 212 | }; |
|---|
| 212 | 213 | |
|---|
| … | … | |
| 248 | 249 | } |
|---|
| 249 | 250 | #define stats_UpdateInteger( a,b,c ) __stats_UpdateInteger( VLC_OBJECT(a),b,c ) |
|---|
| | 251 | |
|---|
| | 252 | |
|---|
| | 253 | struct input_stats_t |
|---|
| | 254 | { |
|---|
| | 255 | /* Input */ |
|---|
| | 256 | int i_read_packets; |
|---|
| | 257 | int i_read_bytes; |
|---|
| | 258 | |
|---|
| | 259 | float f_last_bitrate; |
|---|
| | 260 | float f_average_bitrate; |
|---|
| | 261 | |
|---|
| | 262 | /* Decoders */ |
|---|
| | 263 | |
|---|
| | 264 | /* Vout */ |
|---|
| | 265 | int i_displayed_pictures; |
|---|
| | 266 | int i_lost_pictures; |
|---|
| | 267 | } |
|---|
| r8a8f406 |
r03b059c |
|
| 384 | 384 | p_dec->pf_decode_sub = 0; |
|---|
| 385 | 385 | p_dec->pf_packetize = 0; |
|---|
| | 386 | |
|---|
| | 387 | stats_Create( p_dec, "decoded_audio", VLC_VAR_INTEGER, STATS_COUNTER ); |
|---|
| | 388 | stats_Create( p_dec, "decoded_video", VLC_VAR_INTEGER, STATS_COUNTER ); |
|---|
| | 389 | stats_Create( p_dec, "decoded_sub", VLC_VAR_INTEGER, STATS_COUNTER ); |
|---|
| 386 | 390 | |
|---|
| 387 | 391 | /* Initialize the decoder fifo */ |
|---|
| … | … | |
| 622 | 626 | &p_packetized_block )) ) |
|---|
| 623 | 627 | { |
|---|
| | 628 | stats_UpdateInteger( p_dec, "decoded_audio", 1 ); |
|---|
| 624 | 629 | /* FIXME the best would be to handle the case start_date < preroll < end_date |
|---|
| 625 | 630 | * but that's not easy with non raw audio stream */ |
|---|
| … | … | |
| 645 | 650 | else while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) ) |
|---|
| 646 | 651 | { |
|---|
| | 652 | stats_UpdateInteger( p_dec, "decoded_audio", 1 ); |
|---|
| 647 | 653 | if( p_dec->p_owner->i_preroll_end > 0 && |
|---|
| 648 | 654 | p_aout_buf->start_date < p_dec->p_owner->i_preroll_end ) |
|---|
| … | … | |
| 690 | 696 | &p_packetized_block )) ) |
|---|
| 691 | 697 | { |
|---|
| | 698 | stats_UpdateInteger( p_dec, "decoded_video", 1 ); |
|---|
| 692 | 699 | if( p_dec->p_owner->i_preroll_end > 0 && |
|---|
| 693 | 700 | p_pic->date < p_dec->p_owner->i_preroll_end ) |
|---|
| … | … | |
| 710 | 717 | else while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) ) |
|---|
| 711 | 718 | { |
|---|
| | 719 | stats_UpdateInteger( p_dec, "decoded_video", 1 ); |
|---|
| 712 | 720 | if( p_dec->p_owner->i_preroll_end > 0 && |
|---|
| 713 | 721 | p_pic->date < p_dec->p_owner->i_preroll_end ) |
|---|
| … | … | |
| 729 | 737 | while( (p_spu = p_dec->pf_decode_sub( p_dec, &p_block ) ) ) |
|---|
| 730 | 738 | { |
|---|
| | 739 | stats_UpdateInteger( p_dec, "decoded_sub", 1 ); |
|---|
| 731 | 740 | if( p_dec->p_owner->i_preroll_end > 0 && |
|---|
| 732 | 741 | p_spu->i_start < p_dec->p_owner->i_preroll_end && |
|---|
| r8038a9d |
r03b059c |
|
| 673 | 673 | if( !b_quick ) |
|---|
| 674 | 674 | { |
|---|
| | 675 | stats_Create( p_input, "read_bytes", VLC_VAR_INTEGER, STATS_COUNTER ); |
|---|
| | 676 | stats_Create( p_input, "input_bitrate", VLC_VAR_FLOAT, |
|---|
| | 677 | STATS_DERIVATIVE ); |
|---|
| 675 | 678 | psz = var_GetString( p_input, "sout" ); |
|---|
| 676 | 679 | if( *psz && strncasecmp( p_input->input.p_item->psz_uri, "vlc:", 4 ) ) |
|---|
| r06454cd |
r03b059c |
|
| 1597 | 1597 | } |
|---|
| 1598 | 1598 | |
|---|
| | 1599 | /* Update read bytes in input */ |
|---|
| | 1600 | stats_UpdateInteger( s->p_parent, "read_bytes", i_read ); |
|---|
| | 1601 | |
|---|
| 1599 | 1602 | return i_read; |
|---|
| 1600 | 1603 | } |
|---|
| rdfedddf |
r03b059c |
|
| 903 | 903 | aout_instance_t * p_aout; |
|---|
| 904 | 904 | announce_handler_t * p_announce; |
|---|
| | 905 | stats_handler_t * p_stats; |
|---|
| 905 | 906 | vlc_t *p_vlc = vlc_current_object( i_object ); |
|---|
| 906 | 907 | |
|---|
| … | … | |
| 955 | 956 | vlc_object_release( (vlc_object_t *)p_aout ); |
|---|
| 956 | 957 | aout_Delete( p_aout ); |
|---|
| | 958 | } |
|---|
| | 959 | |
|---|
| | 960 | while( ( p_stats = vlc_object_find( p_vlc, VLC_OBJECT_STATS, FIND_CHILD) )) |
|---|
| | 961 | { |
|---|
| | 962 | vlc_object_detach( (vlc_object_t*) p_stats ); |
|---|
| | 963 | vlc_object_release( (vlc_object_t *)p_stats ); |
|---|
| | 964 | // TODO: Delete it |
|---|
| 957 | 965 | } |
|---|
| 958 | 966 | |
|---|
| r61bf320 |
r03b059c |
|
| 96 | 96 | { |
|---|
| 97 | 97 | case STATS_LAST: |
|---|
| | 98 | case STATS_MIN: |
|---|
| | 99 | case STATS_LAST: |
|---|
| 98 | 100 | if( p_counter->i_samples > 1) |
|---|
| 99 | 101 | { |
|---|
| … | … | |
| 101 | 103 | return VLC_EGENERIC; |
|---|
| 102 | 104 | } |
|---|
| | 105 | if( p_counter->i_type != VLC_VAR_FLOAT && |
|---|
| | 106 | p_counter->i_type != VLC_VAR_INTEGER && |
|---|
| | 107 | p_counter->i_compute_type != STATS_LAST ) |
|---|
| | 108 | { |
|---|
| | 109 | msg_Err( p_handler, "Unable to compute MIN or MAX for this type"); |
|---|
| | 110 | return VLC_EGENERIC; |
|---|
| | 111 | } |
|---|
| | 112 | |
|---|
| 103 | 113 | if( p_counter->i_samples == 0 ) |
|---|
| 104 | 114 | { |
|---|
| … | … | |
| 112 | 122 | if( p_counter->i_samples == 1 ) |
|---|
| 113 | 123 | { |
|---|
| 114 | | if( p_counter->i_type == VLC_VAR_STRING && |
|---|
| 115 | | p_counter->pp_samples[0]->value.psz_string ) |
|---|
| | 124 | /* Update if : LAST or (MAX and bigger) or (MIN and bigger) */ |
|---|
| | 125 | if( p_counter->i_compute_type == STATS_LAST || |
|---|
| | 126 | ( p_counter->i_compute_type == STATS_MAX && |
|---|
| | 127 | ( ( p_counter->i_type == VLC_VAR_INTEGER && |
|---|
| | 128 | p_counter->pp_samples[0]->value.i_int > val.i_int ) || |
|---|
| | 129 | ( p_counter->i_type == VLC_VAR_FLOAT && |
|---|
| | 130 | p_counter->pp_samples[0]->value.f_float > val.f_float ) |
|---|
| | 131 | ) ) || |
|---|
| | 132 | ( p_counter->i_compute_type == STATS_MIN && |
|---|
| | 133 | ( ( p_counter->i_type == VLC_VAR_INTEGER && |
|---|
| | 134 | p_counter->pp_samples[0]->value.i_int < val.i_int ) || |
|---|
| | 135 | ( p_counter->i_type == VLC_VAR_FLOAT && |
|---|
| | 136 | p_counter->pp_samples[0]->value.f_float < val.f_float ) |
|---|
| | 137 | ) ) ) |
|---|
| 116 | 138 | { |
|---|
| 117 | | free( p_counter->pp_samples[0]->value.psz_string ); |
|---|
| | 139 | if( p_counter->i_type == VLC_VAR_STRING && |
|---|
| | 140 | p_counter->pp_samples[0]->value.psz_string ) |
|---|
| | 141 | { |
|---|
| | 142 | free( p_counter->pp_samples[0]->value.psz_string ); |
|---|
| | 143 | } |
|---|
| | 144 | p_counter->pp_samples[0]->value = val; |
|---|
| 118 | 145 | } |
|---|
| 119 | | p_counter->pp_samples[0]->value = val; |
|---|
| 120 | 146 | } |
|---|
| 121 | 147 | break; |
|---|
| | 148 | |
|---|
| 122 | 149 | case STATS_COUNTER: |
|---|
| 123 | 150 | if( p_counter->i_samples > 1) |
|---|
| … | … | |
| 217 | 244 | } |
|---|
| 218 | 245 | |
|---|
| | 246 | |
|---|
| | 247 | void stats_ComputeInputStats( input_thread_t *p_input, |
|---|
| | 248 | input_stats_t *p_stats ) |
|---|
| | 249 | { |
|---|
| | 250 | int i; |
|---|
| | 251 | /* read_packets and read_bytes are common to all streams */ |
|---|
| | 252 | p_stats->i_read_packets = stats_GetInteger( p_input, "read_packets" ); |
|---|
| | 253 | p_stats->i_read_bytes = stats_GetInteger( p_input, "read_bytes" ); |
|---|
| | 254 | |
|---|
| | 255 | } |
|---|
| ra078354 |
r03b059c |
|
| 2060 | 2060 | |
|---|
| 2061 | 2061 | stats_Create( host, "client_connections", VLC_VAR_INTEGER, STATS_COUNTER ); |
|---|
| | 2062 | stats_Create( host, "active_connections", VLC_VAR_INTEGER, STATS_COUNTER ); |
|---|
| 2062 | 2063 | |
|---|
| 2063 | 2064 | while( !host->b_die ) |
|---|
| … | … | |
| 2109 | 2110 | { |
|---|
| 2110 | 2111 | httpd_ClientClean( cl ); |
|---|
| | 2112 | stats_UpdateInteger( host, "active_connections", -1 ); |
|---|
| 2111 | 2113 | TAB_REMOVE( host->i_client, host->client, cl ); |
|---|
| 2112 | 2114 | free( cl ); |
|---|
| … | … | |
| 2564 | 2566 | stats_UpdateInteger( host, "client_connections", |
|---|
| 2565 | 2567 | 1 ); |
|---|
| | 2568 | stats_UpdateInteger( host, "active_connections", 1 ); |
|---|
| 2566 | 2569 | cl = httpd_ClientNew( fd, &sock, i_sock_size, p_tls ); |
|---|
| 2567 | 2570 | p_tls = NULL; |
|---|
| rabebf6c |
r03b059c |
|
| 230 | 230 | } |
|---|
| 231 | 231 | |
|---|
| | 232 | stats_Create( p_vout, "displayed_pictures", VLC_VAR_INTEGER, |
|---|
| | 233 | STATS_COUNTER ); |
|---|
| | 234 | stats_Create( p_vout, "lost_pictures", VLC_VAR_INTEGER, STATS_COUNTER ); |
|---|
| | 235 | |
|---|
| 232 | 236 | /* Initialize pictures - translation tables and functions |
|---|
| 233 | 237 | * will be initialized later in InitThread */ |
|---|
| … | … | |
| 811 | 815 | msg_Warn( p_vout, "late picture skipped ("I64Fd")", |
|---|
| 812 | 816 | current_date - display_date ); |
|---|
| | 817 | stats_UpdateInteger( p_vout, "lost_pictures", 1 ); |
|---|
| 813 | 818 | vlc_mutex_unlock( &p_vout->picture_lock ); |
|---|
| 814 | 819 | |
|---|
| … | … | |
| 833 | 838 | p_vout->i_heap_size--; |
|---|
| 834 | 839 | } |
|---|
| | 840 | stats_UpdateInteger( p_vout, "lost_pictures", 1 ); |
|---|
| 835 | 841 | msg_Warn( p_vout, "vout warning: early picture skipped " |
|---|
| 836 | 842 | "("I64Fd")", display_date - current_date |
|---|
| … | … | |
| 890 | 896 | * Perform rendering |
|---|
| 891 | 897 | */ |
|---|
| | 898 | stats_UpdateInteger( p_vout, "displayed_pictures", 1 ); |
|---|
| 892 | 899 | p_directbuffer = vout_RenderPicture( p_vout, p_picture, p_subpic ); |
|---|
| 893 | 900 | |
|---|