Brian Paul <bri...@vmware.com> writes:
> On 10/25/2012 10:13 AM, Eric Anholt wrote:
>> +struct hash_entry *
>> +_mesa_hash_table_random_entry(struct hash_table *ht,
>> +                              bool (*predicate)(struct hash_entry *entry))
>
> Just curious, what is this function used for?  Just testing?

We have some really stupid behavior some of our caches where when we get
more than n thousand entries, we flush the whole cache and start again.
If you have a function that lets you easily pick a random entry, you can
provide more consistent performance once the app's working set is larger
than the cache size.

I was using this with this hash table in the i965 driver's program cache
at one point, though our new program cache setup makes this harder.

>> diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
>> index d51adf5..13ba16a 100644
>> --- a/src/mesa/sources.mak
>> +++ b/src/mesa/sources.mak
>> @@ -249,6 +249,7 @@ STATETRACKER_FILES = \
>>   PROGRAM_FILES = \
>>      $(SRCDIR)program/arbprogparse.c \
>>      $(SRCDIR)program/chaining_hash_table.c \
>> +    $(SRCDIR)program/hash_table.c \
>>      $(SRCDIR)program/program.c \
>>      $(SRCDIR)program/program_parse_extra.c \
>>      $(SRCDIR)program/prog_cache.c \
>
> Update the SConscript file too?

Done (and the const change).

Attachment: pgpNfAbwHixLn.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to