Changeset 03b059c1b6814784fa731a4687ad45b338fa91e8

Show
Ignore:
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
  • include/vlc_messages.h

    ra5a5d46 r03b059c  
    209209    STATS_MAX, 
    210210    STATS_MIN, 
     211    STATS_DERIVATIVE 
    211212}; 
    212213 
     
    248249} 
    249250#define stats_UpdateInteger( a,b,c ) __stats_UpdateInteger( VLC_OBJECT(a),b,c ) 
     251 
     252 
     253struct 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} 
  • src/input/decoder.c

    r8a8f406 r03b059c  
    384384    p_dec->pf_decode_sub = 0; 
    385385    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 ); 
    386390 
    387391    /* Initialize the decoder fifo */ 
     
    622626                                                       &p_packetized_block )) ) 
    623627                    { 
     628                        stats_UpdateInteger( p_dec, "decoded_audio", 1 ); 
    624629                        /* FIXME the best would be to handle the case start_date < preroll < end_date 
    625630                         * but that's not easy with non raw audio stream */ 
     
    645650        else while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) ) 
    646651        { 
     652            stats_UpdateInteger( p_dec, "decoded_audio", 1 ); 
    647653            if( p_dec->p_owner->i_preroll_end > 0 && 
    648654                p_aout_buf->start_date < p_dec->p_owner->i_preroll_end ) 
     
    690696                                                       &p_packetized_block )) ) 
    691697                    { 
     698                        stats_UpdateInteger( p_dec, "decoded_video", 1 ); 
    692699                        if( p_dec->p_owner->i_preroll_end > 0 && 
    693700                            p_pic->date < p_dec->p_owner->i_preroll_end ) 
     
    710717        else while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) ) 
    711718        { 
     719            stats_UpdateInteger( p_dec, "decoded_video", 1 ); 
    712720            if( p_dec->p_owner->i_preroll_end > 0 && 
    713721                p_pic->date < p_dec->p_owner->i_preroll_end ) 
     
    729737        while( (p_spu = p_dec->pf_decode_sub( p_dec, &p_block ) ) ) 
    730738        { 
     739            stats_UpdateInteger( p_dec, "decoded_sub", 1 ); 
    731740            if( p_dec->p_owner->i_preroll_end > 0 && 
    732741                p_spu->i_start < p_dec->p_owner->i_preroll_end && 
  • src/input/input.c

    r8038a9d r03b059c  
    673673    if( !b_quick ) 
    674674    { 
     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 ); 
    675678        psz = var_GetString( p_input, "sout" ); 
    676679        if( *psz && strncasecmp( p_input->input.p_item->psz_uri, "vlc:", 4 ) ) 
  • src/input/stream.c

    r06454cd r03b059c  
    15971597    } 
    15981598 
     1599    /* Update read bytes in input */ 
     1600    stats_UpdateInteger( s->p_parent, "read_bytes", i_read ); 
     1601 
    15991602    return i_read; 
    16001603} 
  • src/libvlc.c

    rdfedddf r03b059c  
    903903    aout_instance_t    * p_aout; 
    904904    announce_handler_t * p_announce; 
     905    stats_handler_t    * p_stats; 
    905906    vlc_t *p_vlc = vlc_current_object( i_object ); 
    906907 
     
    955956        vlc_object_release( (vlc_object_t *)p_aout ); 
    956957        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 
    957965    } 
    958966 
  • src/misc/stats.c

    r61bf320 r03b059c  
    9696    { 
    9797    case STATS_LAST: 
     98    case STATS_MIN: 
     99    case STATS_LAST: 
    98100        if( p_counter->i_samples > 1) 
    99101        { 
     
    101103            return VLC_EGENERIC; 
    102104        } 
     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 
    103113        if( p_counter->i_samples == 0 ) 
    104114        { 
     
    112122        if( p_counter->i_samples == 1 ) 
    113123        { 
    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                   ) ) ) 
    116138            { 
    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; 
    118145            } 
    119             p_counter->pp_samples[0]->value = val; 
    120146        } 
    121147        break; 
     148 
    122149    case STATS_COUNTER: 
    123150        if( p_counter->i_samples > 1) 
     
    217244} 
    218245 
     246 
     247void 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} 
  • src/network/httpd.c

    ra078354 r03b059c  
    20602060 
    20612061    stats_Create( host, "client_connections", VLC_VAR_INTEGER, STATS_COUNTER ); 
     2062    stats_Create( host, "active_connections", VLC_VAR_INTEGER, STATS_COUNTER ); 
    20622063 
    20632064    while( !host->b_die ) 
     
    21092110            { 
    21102111                httpd_ClientClean( cl ); 
     2112                stats_UpdateInteger( host, "active_connections", -1 ); 
    21112113                TAB_REMOVE( host->i_client, host->client, cl ); 
    21122114                free( cl ); 
     
    25642566                        stats_UpdateInteger( host, "client_connections", 
    25652567                                             1 ); 
     2568                        stats_UpdateInteger( host, "active_connections", 1 ); 
    25662569                        cl = httpd_ClientNew( fd, &sock, i_sock_size, p_tls ); 
    25672570                        p_tls = NULL; 
  • src/video_output/video_output.c

    rabebf6c r03b059c  
    230230    } 
    231231 
     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 
    232236    /* Initialize pictures - translation tables and functions 
    233237     * will be initialized later in InitThread */ 
     
    811815                msg_Warn( p_vout, "late picture skipped ("I64Fd")", 
    812816                                  current_date - display_date ); 
     817                stats_UpdateInteger( p_vout, "lost_pictures", 1 ); 
    813818                vlc_mutex_unlock( &p_vout->picture_lock ); 
    814819 
     
    833838                    p_vout->i_heap_size--; 
    834839                } 
     840                stats_UpdateInteger( p_vout, "lost_pictures", 1 ); 
    835841                msg_Warn( p_vout, "vout warning: early picture skipped " 
    836842                          "("I64Fd")", display_date - current_date 
     
    890896         * Perform rendering 
    891897         */ 
     898        stats_UpdateInteger( p_vout, "displayed_pictures", 1 ); 
    892899        p_directbuffer = vout_RenderPicture( p_vout, p_picture, p_subpic ); 
    893900