mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-09 22:03:15 -05:00
- faster lruhash get_mem routine.
git-svn-id: file:///svn/unbound/trunk@2366 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
6457e97255
commit
35c3a25896
2 changed files with 14 additions and 4 deletions
|
|
@ -1,3 +1,6 @@
|
|||
10 January 2011: Wouter
|
||||
- faster lruhash get_mem routine.
|
||||
|
||||
4 January 2011: Wouter
|
||||
- bug#346: remove ITAR scripts from contrib, the service is discontinued, use the root.
|
||||
- iana portlist updated.
|
||||
|
|
|
|||
|
|
@ -492,13 +492,20 @@ size_t
|
|||
lruhash_get_mem(struct lruhash* table)
|
||||
{
|
||||
size_t s;
|
||||
size_t i;
|
||||
lock_quick_lock(&table->lock);
|
||||
s = sizeof(struct lruhash) + table->space_used;
|
||||
for(i=0; i<table->size; i++) {
|
||||
s += sizeof(struct lruhash_bin) +
|
||||
lock_get_mem(&table->array[i].lock);
|
||||
#ifdef USE_THREAD_DEBUG
|
||||
if(table->size != 0) {
|
||||
size_t i;
|
||||
for(i=0; i<table->size; i++)
|
||||
s += sizeof(struct lruhash_bin) +
|
||||
lock_get_mem(&table->array[i].lock);
|
||||
}
|
||||
#else /* no THREAD_DEBUG */
|
||||
if(table->size != 0)
|
||||
s += (table->size)*(sizeof(struct lruhash_bin) +
|
||||
lock_get_mem(&table->array[0].lock));
|
||||
#endif
|
||||
lock_quick_unlock(&table->lock);
|
||||
s += lock_get_mem(&table->lock);
|
||||
return s;
|
||||
|
|
|
|||
Loading…
Reference in a new issue