mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 09:41:29 -05:00
added method to print cache size
This commit is contained in:
parent
1dbc0c1fcf
commit
d1e95f94a8
@ -1721,3 +1721,38 @@ int RsDataService::setCacheSize(uint32_t /* size */)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RsDataService::debug_printCacheSize() const
|
||||||
|
{
|
||||||
|
uint32_t nb_items,nb_items_on_deadlist;
|
||||||
|
uint64_t total_size,total_size_of_deadlist;
|
||||||
|
|
||||||
|
mGrpMetaDataCache.debug_computeSize(nb_items, nb_items_on_deadlist, total_size,total_size_of_deadlist);
|
||||||
|
|
||||||
|
RsDbg() << "Cache size: " << std::endl;
|
||||||
|
RsDbg() << " Groups: " << " total: " << nb_items << " (dead: " << nb_items_on_deadlist << "), size: " << total_size << " (Dead: " << total_size_of_deadlist << ")" << std::endl;
|
||||||
|
|
||||||
|
nb_items = 0,nb_items_on_deadlist = 0;
|
||||||
|
total_size = 0,total_size_of_deadlist = 0;
|
||||||
|
|
||||||
|
for(auto it:mMsgMetaDataCache)
|
||||||
|
{
|
||||||
|
uint32_t tmp_nb_items,tmp_nb_items_on_deadlist;
|
||||||
|
uint64_t tmp_total_size,tmp_total_size_of_deadlist;
|
||||||
|
|
||||||
|
it.second.debug_computeSize(tmp_nb_items, tmp_nb_items_on_deadlist, tmp_total_size,tmp_total_size_of_deadlist);
|
||||||
|
|
||||||
|
nb_items += tmp_nb_items;
|
||||||
|
nb_items_on_deadlist += tmp_nb_items_on_deadlist;
|
||||||
|
total_size += tmp_total_size;
|
||||||
|
total_size_of_deadlist += tmp_total_size_of_deadlist;
|
||||||
|
}
|
||||||
|
RsDbg() << " Msgs: " << " total: " << nb_items << " (dead: " << nb_items_on_deadlist << "), size: " << total_size << " (Dead: " << total_size_of_deadlist << ")" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,6 +126,16 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void debug_computeSize(uint32_t& nb_items, uint32_t& nb_items_on_deadlist, uint64_t& total_size,uint64_t& total_size_of_deadlist) const
|
||||||
|
{
|
||||||
|
nb_items = mMetas.size();
|
||||||
|
nb_items_on_deadlist = mOldCachedItems.size();
|
||||||
|
total_size = 0;
|
||||||
|
total_size_of_deadlist = 0;
|
||||||
|
|
||||||
|
for(auto it:mMetas) total_size += it.second->serial_size();
|
||||||
|
for(auto it:mOldCachedItems) total_size_of_deadlist += it.second->serial_size();
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
std::map<ID,MetaDataClass*> mMetas;
|
std::map<ID,MetaDataClass*> mMetas;
|
||||||
std::list<std::pair<rstime_t,MetaDataClass*> > mOldCachedItems ; // dead list, where items get deleted after being unused for a while. This is due to not using smart ptrs.
|
std::list<std::pair<rstime_t,MetaDataClass*> > mOldCachedItems ; // dead list, where items get deleted after being unused for a while. This is due to not using smart ptrs.
|
||||||
@ -274,6 +284,8 @@ public:
|
|||||||
|
|
||||||
int updateGroupKeys(const RsGxsGroupId& grpId,const RsTlvSecurityKeySet& keys, uint32_t subscribe_flags) ;
|
int updateGroupKeys(const RsGxsGroupId& grpId,const RsTlvSecurityKeySet& keys, uint32_t subscribe_flags) ;
|
||||||
|
|
||||||
|
void debug_printCacheSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
bool deserialise(void *data, uint32_t &pktsize);
|
bool deserialise(void *data, uint32_t &pktsize);
|
||||||
bool serialise(void* data, uint32_t &pktsize, uint32_t api_version);
|
bool serialise(void* data, uint32_t &pktsize, uint32_t api_version);
|
||||||
uint32_t serial_size(uint32_t api_version) const;
|
uint32_t serial_size(uint32_t api_version) const;
|
||||||
|
uint32_t serial_size() const { return serial_size(RS_GXS_GRP_META_DATA_CURRENT_API_VERSION); }
|
||||||
void clear();
|
void clear();
|
||||||
void operator =(const RsGroupMetaData& rMeta);
|
void operator =(const RsGroupMetaData& rMeta);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user