Files
test/source/blender/blenlib/intern/hash_tables.cc
Hans Goudey fa34992def Cleanup: Remove unnecessary includes from C++ data structure headers
The hash tables and vector blenlib headers were pulling many more
headers than they actually need, including the C base math header,
our C string API header, and the StringRef header. All of this
potentially slows down compilation and polutes autocomplete
with unrelated information.

Also remove the `ListBase` constructor for `Vector`. It wasn't used
much, and making it easy to use `ListBase` isn't worth it for the
same reasons mentioned above.

It turns out a lot of files depended on indirect includes of
`BLI_string.h` and `BLI_listbase.h`, so those are fixed here.

Pull Request: https://projects.blender.org/blender/blender/pulls/111801
2023-09-01 21:37:11 +02:00

30 lines
1.1 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_hash_tables.hh"
#include "BLI_string.h"
#include <iostream>
void blender::HashTableStats::print(const char *name) const
{
std::cout << "Hash Table Stats: " << name << "\n";
std::cout << " Address: " << address_ << "\n";
std::cout << " Total Slots: " << capacity_ << "\n";
std::cout << " Occupied Slots: " << size_ << " (" << load_factor_ * 100.0f << " %)\n";
std::cout << " Removed Slots: " << removed_amount_ << " (" << removed_load_factor_ * 100.0f
<< " %)\n";
char memory_size_str[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE];
BLI_str_format_byte_unit(memory_size_str, size_in_bytes_, true);
std::cout << " Size: ~" << memory_size_str << "\n";
std::cout << " Size per Slot: " << size_per_element_ << " bytes\n";
std::cout << " Average Collisions: " << average_collisions_ << "\n";
for (int64_t collision_count : keys_by_collision_count_.index_range()) {
std::cout << " " << collision_count
<< " Collisions: " << keys_by_collision_count_[collision_count] << "\n";
}
}