added more debug output in icon loading system

This commit is contained in:
csoler 2019-06-04 13:01:35 +02:00
parent 94cbe65142
commit 9bc552aea4
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -507,6 +507,8 @@ void GxsIdDetails::checkCleanImagesCache()
{ {
std::cerr << "(II) Cleaning the icons cache." << std::endl; std::cerr << "(II) Cleaning the icons cache." << std::endl;
int nb_deleted = 0; int nb_deleted = 0;
uint32_t size_deleted = 0;
uint32_t total_size = 0;
for(auto it(mDefaultIconCache.begin());it!=mDefaultIconCache.end();) for(auto it(mDefaultIconCache.begin());it!=mDefaultIconCache.end();)
{ {
@ -515,14 +517,20 @@ void GxsIdDetails::checkCleanImagesCache()
for(int i=0;i<4;++i) for(int i=0;i<4;++i)
if(it->second[i].first + ICON_CACHE_STORAGE_TIME < now && it->second[i].second.isDetached()) if(it->second[i].first + ICON_CACHE_STORAGE_TIME < now && it->second[i].second.isDetached())
{ {
it->second[i].second = QPixmap(); int s = it->second[i].second.width()*it->second[i].second.height()*4;
std::cerr << "Deleting pixmap " << it->first << " size " << i << std::endl; std::cerr << "Deleting pixmap " << it->first << " size " << i << " " << s << " bytes." << std::endl;
it->second[i].second = QPixmap();
it = mDefaultIconCache.erase(it); it = mDefaultIconCache.erase(it);
++nb_deleted; ++nb_deleted;
size_deleted += s;
} }
else else
{
all_empty = false; all_empty = false;
total_size += it->second[i].second.width()*it->second[i].second.height()*4;
}
if(all_empty) if(all_empty)
it = mDefaultIconCache.erase(it); it = mDefaultIconCache.erase(it);
@ -531,7 +539,7 @@ void GxsIdDetails::checkCleanImagesCache()
} }
mLastIconCacheCleaning = now; mLastIconCacheCleaning = now;
std::cerr << "(II) Removed " << nb_deleted << " unused icons. Cache contains " << mDefaultIconCache.size() << " icons"<< std::endl; std::cerr << "(II) Removed " << nb_deleted << " (" << size_deleted << " bytes) unused icons. Cache contains " << mDefaultIconCache.size() << " icons (" << total_size << " bytes)"<< std::endl;
} }
} }