//============================================================ // <T>输出统计信息。</T> //============================================================ void FNetMessageStatisticsMachine::Dump(TFsDump& dump){ TInt count = ValidCount(); if(count > 0){ dump.AppendFormat("\n-- Message statistics. (name=%s, count=%d)", (TCharC*)_name, count); TInt size = _statistics.Size(); for(TInt n = 0; n < size; n++){ FNetMessageStatistics* pStatistics = _statistics[n]; if(NULL != pStatistics){ TInt code = pStatistics->Code(); TCharC* pName = RNetMessageFactory::CodeName(code); dump.AppendFormat("\n " MO_FMT_OBJECT_NAME " code=0x%04X count=%8d, tick=(%8d - %-8d) - %8d (failure=%16lld, slow=%16lld, socket=%16lld)", pName, code, pStatistics->Count(), pStatistics->MinTick(), pStatistics->MaxTick(), pStatistics->AverageTick(), pStatistics->FailureCount(), pStatistics->SlowCount(), pStatistics->SocketClose()); } } } }
void ECCacheBase::DumpStats(ECLogger *lpLogger) { std::string strName; strName = m_strCachename + " cache size:"; lpLogger->Log(EC_LOGLEVEL_FATAL, " %-30s %8lu (%8llu bytes) (usage %.02f%%)", strName.c_str(), ItemCount(), Size(), Size() / (double)MaxSize() * 100.0); strName = m_strCachename + " cache hits:"; lpLogger->Log(EC_LOGLEVEL_FATAL, " %-30s %8llu / %llu (%.02f%%)", strName.c_str(), ValidCount(), HitCount(), ValidCount() / (double)HitCount() * 100.0); }
void ECCacheBase::RequestStats(void(callback)(const std::string &, const std::string &, const std::string &, void*), void *obj) { callback((std::string)"cache_" + m_strCachename + "_items", (std::string)"Cache " + m_strCachename + " items", stringify_int64(ItemCount()), obj); callback((std::string)"cache_" + m_strCachename + "_size", (std::string)"Cache " + m_strCachename + " size", stringify_int64(Size()), obj); callback((std::string)"cache_" + m_strCachename + "_maxsz", (std::string)"Cache " + m_strCachename + " maximum size", stringify_int64(m_ulMaxSize), obj); callback((std::string)"cache_" + m_strCachename + "_req", (std::string)"Cache " + m_strCachename + " requests", stringify_int64(HitCount()), obj); callback((std::string)"cache_" + m_strCachename + "_hit", (std::string)"Cache " + m_strCachename + " hits", stringify_int64(ValidCount()), obj); }