efficient / libcuckoo

A high-performance, concurrent hash table
Other
1.61k stars 275 forks source link

Estimate memory usage #98

Closed anuragkh closed 6 years ago

anuragkh commented 6 years ago

Hi, is it possible to estimate the total memory usage of the data structures in cuckoohash_map? (Not just for the key-value bytes)

manugoyal commented 6 years ago

Hi Anurag, indeed it should be possible to profile overall memory usage in libcuckoo. The universal_benchmark (https://github.com/efficient/libcuckoo/tree/master/tests/universal-benchmark) contains a compile-time option to enable memory-usage sampling in the table. It makes use of an instrumented allocator (implemented in https://github.com/efficient/libcuckoo/blob/master/tests/universal-benchmark/universal_table_wrapper.hh), which keeps track of the amount of memory the table has allocated.

If you were just curious about what other types of data structures (other than the key-value pairs themselves) are present in the table, I'd recommend looking at the private members in the source code (https://github.com/efficient/libcuckoo/blob/1156aa8b1076da9931409b9d409d8edb377b50f3/libcuckoo/cuckoohash_map.hh#L1834), specifically the bucket container (https://github.com/efficient/libcuckoo/blob/master/libcuckoo/libcuckoo_bucket_container.hh) and the locks container (https://github.com/efficient/libcuckoo/blob/1156aa8b1076da9931409b9d409d8edb377b50f3/libcuckoo/cuckoohash_map.hh#L796)

anuragkh commented 6 years ago

Thanks!