memory: hashed statistics for alien threads
memory: hashed statistics for alien threads

When using alien threads, seastar regular thread_local statistics
won't be collected.

A different approach, as discussed in [0], is to keep record of the
allocations statistics in an array. Each alien thread will record its
statistics to bucket "hashed_thread_id % total_num_buckets".

When collecting statistics one can go over the buckets and get an
estimate of foreign threads behavior, hoping there are few collisions.

This would assure us statistics will work well even when creating and
destroying many foreign threads.

[0] https://groups.google.com/d/msg/seastar-dev/vpmi31RNu0M/cUhsdFMVBgAJ

[avi: add #include <thread> for std::thread::id]
[avi: remove now-unused g_allocs and friends]
Signed-off-by: Elazar Leibovich <f66bf065cb40f105b126445a801a635b6b1cbf14@gmail.com>

avikivity/seastar,avikivity/seastar,cloudius-systems/seastar,syuu1228/seastar,dreamsxin/seastar,syuu1228/seastar,dreamsxin/seastar,scylladb/seastar,syuu1228/seastar,dreamsxin/seastar,cloudius-systems/seastar,scylladb/seastar,cloudius-systems/seastar,avikivity/seastar,scylladb/seastar