25#ifndef DBGHELP_STATIC_LIB
47 a->arena_size = arena_size;
72 FIXME(
"STATS: pool %p has allocated %u kbytes, used %u kbytes in %u arenas, non-allocation ratio: %.2f%%\n",
74 100.0 - (
float)
used / (
float)
alloc * 100.0);
114 if (!arena)
return NULL;
137 v->elt_size = (esz + 3) & ~3;
140 case 2:
v->shift = 1;
break;
141 case 4:
v->shift = 2;
break;
142 case 8:
v->shift = 3;
break;
143 case 16:
v->shift = 4;
break;
144 case 32:
v->shift = 5;
break;
145 case 64:
v->shift = 6;
break;
146 case 128:
v->shift = 7;
break;
147 case 256:
v->shift = 8;
break;
148 case 512:
v->shift = 9;
break;
149 case 1024:
v->shift = 10;
break;
153 v->buckets_allocated = 0;
166 if (
pos >=
v->num_elts)
return NULL;
167 o =
pos & ((1 <<
v->shift) - 1);
168 return (
char*)
v->buckets[
pos >>
v->shift] + o *
v->elt_size;
173 unsigned ncurr =
v->num_elts++;
177 if (ncurr == (
v->num_buckets <<
v->shift))
179 if(
v->num_buckets ==
v->buckets_allocated)
182 unsigned new_reserved;
185 new_reserved = 2*
v->buckets_allocated;
186 if(new_reserved == 0) new_reserved = 1;
191 memcpy(
new,
v->buckets,
v->buckets_allocated *
sizeof(
void*));
193 v->buckets_allocated = new_reserved;
196 return v->buckets[
v->num_buckets++];
230 if (!
sa->elements.num_elts)
235 high =
sa->elements.num_elts;
257 *
idx = (low + high) / 2;
260 else if (pk2i->
key <
key) low = *
idx + 1;
289 if (pk2i && pk2i->
key ==
key)
291 FIXME(
"re-adding an existing key\n");
299 assert(
sa->key2index.num_elts >= 2);
300 for (
i =
sa->key2index.num_elts - 1;
i >
idx;
i--)
309 to->
index =
sa->elements.num_elts;
316 return sa->elements.num_elts;
344#if defined(USE_STATS)
347 unsigned min = 0xffffffff,
max = 0,
sq = 0;
349 double mean, variance;
351 for (
i = 0;
i <
ht->num_buckets;
i++)
353 for (
len = 0, elt =
ht->buckets[
i]; elt; elt = elt->
next)
len++;
358 mean = (
double)
ht->num_elts /
ht->num_buckets;
359 variance = (
double)
sq /
ht->num_buckets - mean * mean;
360 FIXME(
"STATS: elts[num:%-4u size:%u mean:%f] buckets[min:%-4u variance:%+f max:%-4u]\n",
361 ht->num_elts,
ht->num_buckets, mean,
min, variance,
max);
363 for (
i = 0;
i <
ht->num_buckets;
i++)
365 for (
len = 0, elt =
ht->buckets[
i]; elt; elt = elt->
next)
len++;
368 FIXME(
"Longest bucket:\n");
369 for (elt =
ht->buckets[
i]; elt; elt = elt->
next)
392 if (!
ht->buckets[
hash].first)
394 ht->buckets[
hash].first = elt;
398 ht->buckets[
hash].last->next = elt;
400 ht->buckets[
hash].last = elt;
416 hti->
last =
ht->num_buckets - 1;
424 if (!hti->
ht->buckets)
return NULL;
ACPI_SIZE strlen(const char *String)
static struct sockaddr_in sa
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_add_head(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
void hash_table_init(struct pool *pool, struct hash_table *ht, unsigned num_buckets)
void * sparse_array_find(const struct sparse_array *sa, ULONG_PTR key)
unsigned vector_length(const struct vector *v)
static unsigned hash_table_hash(const char *name, unsigned num_buckets)
void pool_destroy(struct pool *pool)
void * vector_at(const struct vector *v, unsigned pos)
char * pool_strdup(struct pool *pool, const char *str)
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name)
void * sparse_array_add(struct sparse_array *sa, ULONG_PTR key, struct pool *pool)
void sparse_array_init(struct sparse_array *sa, unsigned elt_sz, unsigned bucket_sz)
void pool_init(struct pool *a, size_t arena_size)
void hash_table_add(struct hash_table *ht, struct hash_table_elt *elt)
void * pool_alloc(struct pool *pool, size_t len)
unsigned sparse_array_length(const struct sparse_array *sa)
void vector_init(struct vector *v, unsigned esz, unsigned bucket_sz)
static struct key2index * sparse_array_lookup(const struct sparse_array *sa, ULONG_PTR key, unsigned *idx)
void hash_table_destroy(struct hash_table *ht)
void * hash_table_iter_up(struct hash_table_iter *hti)
void * vector_add(struct vector *v, struct pool *pool)
#define HeapFree(x, y, z)
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static const struct newhuff ht[]
#define memcpy(s1, s2, n)
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
static unsigned __int64 next
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
struct hash_table_elt * next
struct hash_table_elt * element
const struct hash_table * ht