| 615 | |
| 616 | |
| 617 | stat_var* __get_stat( const str *name, int mod_idx ) |
| 618 | { |
| 619 | stat_var *stat; |
| 620 | int hash; |
| 621 | |
| 622 | if (collector==NULL || name==0 || name->s==0 || name->len==0) |
| 623 | return 0; |
| 624 | |
| 625 | /* compute the hash by name */ |
| 626 | hash = stat_hash( name ); |
| 627 | |
| 628 | /* and look for it , first in the hash for static stats */ |
| 629 | for( stat=collector->hstats[hash] ; stat ; stat=stat->hnext ) { |
| 630 | if ( !stat_is_hidden(stat) && (stat->name.len==name->len) && |
| 631 | (strncasecmp( stat->name.s, name->s, name->len)==0) && |
| 632 | (mod_idx < 0 || stat->mod_idx == mod_idx)) |
| 633 | return stat; |
| 634 | } |
| 635 | /* and then in the hash for dynamic stats */ |
| 636 | lock_start_read((rw_lock_t *)collector->rwl); |
| 637 | for( stat=collector->dy_hstats[hash] ; stat ; stat=stat->hnext ) { |
| 638 | if ( !stat_is_hidden(stat) && (stat->name.len==name->len) && |
| 639 | (strncasecmp( stat->name.s, name->s, name->len)==0) && |
| 640 | (mod_idx < 0 || stat->mod_idx == mod_idx)) { |
| 641 | lock_stop_read((rw_lock_t *)collector->rwl); |
| 642 | return stat; |
| 643 | } |
| 644 | } |
| 645 | lock_stop_read((rw_lock_t *)collector->rwl); |
| 646 | |
| 647 | return 0; |
| 648 | } |
| 649 | |
| 650 | stat_var* get_stat( const str *name ) |
| 651 | { |
no outgoing calls
no test coverage detected