refactor: debug count and popup (#4921)

* Moved implementation of the methods to the `cpp` file.
* Added `DebugCount::Flag(s)` and `DebugCount::configure(name, flags)`.
* Moved from `QMap` to `std::map` (order is important here).
* Used `QStringBuilder` for concatenations.
* Used `QLocale` for formatting (adds separators).
* Added `DebugCount::Flag::DataSize` for data sizes in bytes (and fixed language to English).
* Used `DataSize` for image sizes (maybe this should be moved somewhere else?).
* Added copy button to popup.
* Fixed Image usage reporting being eight times too large (could be another PR, but honestly it's four characters).
This commit is contained in:
nerix
2023-10-28 21:17:32 +02:00
committed by GitHub
parent 5c0219c245
commit 7ecbfa0cdb
5 changed files with 151 additions and 98 deletions
+8 -1
View File
@@ -108,7 +108,7 @@ namespace detail {
{
auto sz = frame.image.size();
auto area = sz.width() * sz.height();
auto memory = area * frame.image.depth();
auto memory = area * frame.image.depth() / 8;
usage += memory;
}
@@ -608,6 +608,13 @@ ImageExpirationPool::ImageExpirationPool()
this->freeTimer_->start(
std::chrono::duration_cast<std::chrono::milliseconds>(
IMAGE_POOL_CLEANUP_INTERVAL));
// configure all debug counts used by images
DebugCount::configure("image bytes", DebugCount::Flag::DataSize);
DebugCount::configure("image bytes (ever loaded)",
DebugCount::Flag::DataSize);
DebugCount::configure("image bytes (ever unloaded)",
DebugCount::Flag::DataSize);
}
ImageExpirationPool &ImageExpirationPool::instance()