Changeset 8d995e6f088eeee7d5ee5896b23c0a1347b27256
- 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
| rbcf4277 |
r8d995e6 |
|
| 471 | 471 | src/misc/vlm.c \ |
|---|
| 472 | 472 | src/misc/xml.c \ |
|---|
| | 473 | src/misc/hashtables.c \ |
|---|
| 473 | 474 | src/misc/version.c \ |
|---|
| 474 | 475 | src/extras/libc.c \ |
|---|
| rbcf4277 |
r8d995e6 |
|
| 203 | 203 | typedef struct variable_t variable_t; |
|---|
| 204 | 204 | typedef struct date_t date_t; |
|---|
| | 205 | typedef struct hashtable_entry_t hashtable_entry_t; |
|---|
| 205 | 206 | |
|---|
| 206 | 207 | /* Messages */ |
|---|
| … | … | |
| 643 | 644 | } |
|---|
| 644 | 645 | |
|---|
| | 646 | /* Hash tables handling */ |
|---|
| | 647 | struct hashtable_entry_t |
|---|
| | 648 | { |
|---|
| | 649 | int i_id; |
|---|
| | 650 | char *psz_name; |
|---|
| | 651 | uint64_t i_hash; |
|---|
| | 652 | void *p_data; |
|---|
| | 653 | }; |
|---|
| | 654 | |
|---|
| | 655 | VLC_EXPORT( void, vlc_HashInsert, (hashtable_entry_t **, int *, int, const char *, void *)); |
|---|
| | 656 | VLC_EXPORT( void*, vlc_HashRetrieve, (hashtable_entry_t*, int, int, const char *) ); |
|---|
| | 657 | VLC_EXPORT( int, vlc_HashLookup, (hashtable_entry_t *, int, int, const char *) ); |
|---|
| | 658 | |
|---|
| | 659 | |
|---|
| 645 | 660 | /* MSB (big endian)/LSB (little endian) conversions - network order is always |
|---|
| 646 | 661 | * MSB, and should be used for both network communications and files. Note that |
|---|
| r1ab9075 |
r8d995e6 |
|
| 244 | 244 | VLC_COMMON_MEMBERS |
|---|
| 245 | 245 | |
|---|
| 246 | | int i_counters; |
|---|
| 247 | | counter_t **pp_counters; |
|---|
| | 246 | int i_counters; |
|---|
| | 247 | hashtable_entry_t * p_counters; |
|---|
| 248 | 248 | }; |
|---|
| 249 | 249 | |
|---|
| rbcf4277 |
r8d995e6 |
|
| 309 | 309 | int playlist_LockReplace (playlist_t *,playlist_item_t *, input_item_t*); |
|---|
| 310 | 310 | int __intf_Eject (vlc_object_t *, const char *); |
|---|
| | 311 | void vlc_HashInsert (hashtable_entry_t **, int *, int, const char *, void *); |
|---|
| 311 | 312 | int input_Control (input_thread_t *, int i_query, ...); |
|---|
| 312 | 313 | int __aout_VolumeUp (vlc_object_t *, int, audio_volume_t *); |
|---|
| … | … | |
| 317 | 318 | sout_instance_t * __sout_NewInstance (vlc_object_t *, char *); |
|---|
| 318 | 319 | subpicture_t * spu_CreateSubpicture (spu_t *); |
|---|
| | 320 | int vlc_HashLookup (hashtable_entry_t *, int, int, const char *); |
|---|
| 319 | 321 | void httpd_MsgAdd (httpd_message_t *, char *psz_name, char *psz_value, ...); |
|---|
| 320 | 322 | int vout_vaControlDefault (vout_thread_t *, int, va_list); |
|---|
| … | … | |
| 360 | 362 | decoder_t * input_DecoderNew (input_thread_t *, es_format_t *, vlc_bool_t b_force_decoder); |
|---|
| 361 | 363 | xml_t * __xml_Create (vlc_object_t *); |
|---|
| | 364 | void* vlc_HashRetrieve (hashtable_entry_t*, int, int, const char *); |
|---|
| 362 | 365 | msg_subscription_t* __msg_Subscribe (vlc_object_t *, int); |
|---|
| 363 | 366 | const char * VLC_Version (void); |
|---|
| … | … | |
| 920 | 923 | update_t * (*__update_New_inner) (vlc_object_t *); |
|---|
| 921 | 924 | 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 *); |
|---|
| 922 | 928 | }; |
|---|
| 923 | 929 | # if defined (__PLUGIN__) |
|---|
| … | … | |
| 1364 | 1370 | # define __update_New (p_symbols)->__update_New_inner |
|---|
| 1365 | 1371 | # 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 |
|---|
| 1366 | 1375 | # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) |
|---|
| 1367 | 1376 | /****************************************************************** |
|---|
| … | … | |
| 1811 | 1820 | ((p_symbols)->__update_New_inner) = __update_New; \ |
|---|
| 1812 | 1821 | ((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; \ |
|---|
| 1813 | 1825 | (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ |
|---|
| 1814 | 1826 | (p_symbols)->__stats_CounterGet_deprecated = NULL; \ |
|---|
| radc858d |
r8d995e6 |
|
| 58 | 58 | { |
|---|
| 59 | 59 | 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; |
|---|
| 61 | 62 | |
|---|
| 62 | 63 | for( j = p_counter->i_samples -1; j >= 0 ; j-- ) |
|---|
| … | … | |
| 67 | 68 | } |
|---|
| 68 | 69 | 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 ); |
|---|
| 70 | 72 | free( p_counter ); |
|---|
| 71 | 73 | } |
|---|
| … | … | |
| 110 | 112 | p_counter->last_update = 0; |
|---|
| 111 | 113 | |
|---|
| 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 ); |
|---|
| 116 | 116 | |
|---|
| 117 | 117 | vlc_mutex_unlock( &p_handler->object_lock ); |
|---|
| … | … | |
| 468 | 468 | for ( i = 0 ; i< p_handler->i_counters; i++ ) |
|---|
| 469 | 469 | { |
|---|
| 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 ); |
|---|
| 473 | 474 | } |
|---|
| 474 | 475 | } |
|---|
| … | … | |
| 614 | 615 | { |
|---|
| 615 | 616 | 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 ); |
|---|
| 626 | 619 | } |
|---|
| 627 | 620 | |
|---|
| … | … | |
| 665 | 658 | } |
|---|
| 666 | 659 | p_handler->i_counters = 0; |
|---|
| 667 | | p_handler->pp_counters = NULL; |
|---|
| | 660 | p_handler->p_counters = (hashtable_entry_t *) malloc( 5 * sizeof( variable_t ) ); |
|---|
| 668 | 661 | |
|---|
| 669 | 662 | /// \bug is it p_vlc or p_libvlc ? |
|---|