Changeset 8d995e6f088eeee7d5ee5896b23c0a1347b27256

Show
Ignore:
Timestamp:
02/04/06 00:52:45 (3 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1139010765 +0000
git-parent:

[661a6c1357158cb970fd2b92fc5d126d65e021ac]

git-author:
Clément Stenac <zorglub@videolan.org> 1139010765 +0000
Message:

Use a hash for stats. Not finished

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Makefile.am

    rbcf4277 r8d995e6  
    471471    src/misc/vlm.c \ 
    472472    src/misc/xml.c \ 
     473    src/misc/hashtables.c \ 
    473474    src/misc/version.c \ 
    474475    src/extras/libc.c \ 
  • include/vlc_common.h

    rbcf4277 r8d995e6  
    203203typedef struct variable_t variable_t; 
    204204typedef struct date_t date_t; 
     205typedef struct hashtable_entry_t hashtable_entry_t; 
    205206 
    206207/* Messages */ 
     
    643644    } 
    644645 
     646/* Hash tables handling */ 
     647struct hashtable_entry_t 
     648{ 
     649    int       i_id; 
     650    char     *psz_name; 
     651    uint64_t  i_hash; 
     652    void     *p_data; 
     653}; 
     654 
     655VLC_EXPORT( void, vlc_HashInsert, (hashtable_entry_t **, int *, int, const char *, void *)); 
     656VLC_EXPORT( void*, vlc_HashRetrieve, (hashtable_entry_t*, int, int, const char *) ); 
     657VLC_EXPORT( int, vlc_HashLookup, (hashtable_entry_t *, int, int, const char *) ); 
     658 
     659 
    645660/* MSB (big endian)/LSB (little endian) conversions - network order is always 
    646661 * MSB, and should be used for both network communications and files. Note that 
  • include/vlc_messages.h

    r1ab9075 r8d995e6  
    244244    VLC_COMMON_MEMBERS 
    245245 
    246     int         i_counters; 
    247     counter_t **pp_counters; 
     246    int                 i_counters; 
     247    hashtable_entry_t * p_counters; 
    248248}; 
    249249 
  • include/vlc_symbols.h

    rbcf4277 r8d995e6  
    309309int playlist_LockReplace (playlist_t *,playlist_item_t *, input_item_t*); 
    310310int __intf_Eject (vlc_object_t *, const char *); 
     311void vlc_HashInsert (hashtable_entry_t **, int *, int, const char *, void *); 
    311312int input_Control (input_thread_t *, int i_query, ...); 
    312313int __aout_VolumeUp (vlc_object_t *, int, audio_volume_t *); 
     
    317318sout_instance_t * __sout_NewInstance (vlc_object_t *, char *); 
    318319subpicture_t * spu_CreateSubpicture (spu_t *); 
     320int vlc_HashLookup (hashtable_entry_t *, int, int, const char *); 
    319321void httpd_MsgAdd (httpd_message_t *, char *psz_name, char *psz_value, ...); 
    320322int vout_vaControlDefault (vout_thread_t *, int, va_list); 
     
    360362decoder_t * input_DecoderNew (input_thread_t *, es_format_t *, vlc_bool_t b_force_decoder); 
    361363xml_t * __xml_Create (vlc_object_t *); 
     364void* vlc_HashRetrieve (hashtable_entry_t*, int, int, const char *); 
    362365msg_subscription_t* __msg_Subscribe (vlc_object_t *, int); 
    363366const char * VLC_Version (void); 
     
    920923    update_t * (*__update_New_inner) (vlc_object_t *); 
    921924    void (*update_download_inner) (update_iterator_t *, char *); 
     925    void (*vlc_HashInsert_inner) (hashtable_entry_t **, int *, int, const char *, void *); 
     926    int (*vlc_HashLookup_inner) (hashtable_entry_t *, int, int, const char *); 
     927    void* (*vlc_HashRetrieve_inner) (hashtable_entry_t*, int, int, const char *); 
    922928}; 
    923929#  if defined (__PLUGIN__) 
     
    13641370#  define __update_New (p_symbols)->__update_New_inner 
    13651371#  define update_download (p_symbols)->update_download_inner 
     1372#  define vlc_HashInsert (p_symbols)->vlc_HashInsert_inner 
     1373#  define vlc_HashLookup (p_symbols)->vlc_HashLookup_inner 
     1374#  define vlc_HashRetrieve (p_symbols)->vlc_HashRetrieve_inner 
    13661375#  elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) 
    13671376/****************************************************************** 
     
    18111820    ((p_symbols)->__update_New_inner) = __update_New; \ 
    18121821    ((p_symbols)->update_download_inner) = update_download; \ 
     1822    ((p_symbols)->vlc_HashInsert_inner) = vlc_HashInsert; \ 
     1823    ((p_symbols)->vlc_HashLookup_inner) = vlc_HashLookup; \ 
     1824    ((p_symbols)->vlc_HashRetrieve_inner) = vlc_HashRetrieve; \ 
    18131825    (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ 
    18141826    (p_symbols)->__stats_CounterGet_deprecated = NULL; \ 
  • src/misc/stats.c

    radc858d r8d995e6  
    5858    { 
    5959        int j; 
    60         counter_t * p_counter = p_stats->pp_counters[i]; 
     60        hashtable_entry_t p_entry = p_stats->p_counters[i]; 
     61        counter_t * p_counter = p_entry.p_data; 
    6162 
    6263        for( j = p_counter->i_samples -1; j >= 0 ; j-- ) 
     
    6768        } 
    6869        free( p_counter->psz_name ); 
    69         REMOVE_ELEM( p_stats->pp_counters, p_stats->i_counters, i ); 
     70        free( p_entry.psz_name ); 
     71        REMOVE_ELEM( p_stats->p_counters, p_stats->i_counters, i ); 
    7072        free( p_counter ); 
    7173    } 
     
    110112    p_counter->last_update = 0; 
    111113 
    112     INSERT_ELEM( p_handler->pp_counters, 
    113                  p_handler->i_counters, 
    114                  p_handler->i_counters, 
    115                  p_counter ); 
     114    vlc_HashInsert( &p_handler->p_counters, &p_handler->i_counters, p_this->i_object_id, 
     115                    psz_name, p_counter ); 
    116116 
    117117    vlc_mutex_unlock( &p_handler->object_lock ); 
     
    468468    for ( i = 0 ; i< p_handler->i_counters; i++ ) 
    469469    { 
    470         if( p_handler->pp_counters[i]->i_compute_type == STATS_TIMER ) 
    471         { 
    472             TimerDump( p_obj, p_handler->pp_counters[i], VLC_FALSE ); 
     470        counter_t * p_counter = (counter_t *)(p_handler->p_counters[i].p_data); 
     471        if( p_counter->i_compute_type == STATS_TIMER ) 
     472        { 
     473            TimerDump( p_obj, p_counter, VLC_FALSE ); 
    473474        } 
    474475    } 
     
    614615{ 
    615616    int i; 
    616    for( i = 0; i< p_handler->i_counters; i++ ) 
    617     { 
    618         counter_t *p_counter = p_handler->pp_counters[i]; 
    619         if( p_counter->i_source_object == i_object_id && 
    620             !strcmp( p_counter->psz_name, psz_name ) ) 
    621         { 
    622             return p_counter; 
    623         } 
    624     } 
    625     return NULL; 
     617    return (counter_t *)vlc_HashRetrieve( p_handler->p_counters, p_handler->i_counters, 
     618                                          i_object_id, psz_name ); 
    626619} 
    627620 
     
    665658    } 
    666659    p_handler->i_counters = 0; 
    667     p_handler->pp_counters = NULL
     660    p_handler->p_counters = (hashtable_entry_t *) malloc( 5 * sizeof( variable_t ) )
    668661 
    669662    /// \bug is it p_vlc or p_libvlc ?