void mem_alloc_show_stats	()
	{
		u32						size = (u32)stats.size();
		STATS_PAIR				*strings = (STATS_PAIR*)_alloca(size*sizeof(STATS_PAIR));
		STATS_PAIR				*e = strings + size;
		STATS_PAIR				*i = strings;

		u32						accumulator = 0;
		STATS::const_iterator	I = stats.begin();
		STATS::const_iterator	E = stats.end();
		for ( ; I != E; ++I, ++i) {
			*i					= (*I).second;
			accumulator			+= (*I).second.second;
		}

		struct predicate {
			static inline bool compare	(const STATS_PAIR &_0, const STATS_PAIR &_1)
			{
				return			(_0.second < _1.second);
			}
		};

		std::sort				(strings,e,predicate::compare);

		int						j = 0;
		for (i = strings; i != e; ++i, ++j) {
			Msg					("%d(%d)-----------------%d[%d]:%5.2f%%------------------",j,size,(*i).second,accumulator,((*i).second*100)/float(accumulator));
			Log					((*i).first);
		}
	}
예제 #2
0
IC	void CSmartCastStats::show					()
{
	if (m_stats.empty()) {
		Msg								("CONGRATULATIONS : SmartCast stats is empty!!!");
		return;
	}

	m_temp.clear						();
	m_temp.insert						(m_temp.begin(),m_stats.begin(),m_stats.end());
	std::sort							(m_temp.begin(),m_temp.end(),CStatsPredicate());
	u32									total = 0;

	xr_vector<CStats>::const_iterator	I = m_temp.begin();
	xr_vector<CStats>::const_iterator	E = m_temp.end();
	for ( ; I != E; ++I)
		total							+= (*I).m_count;

	Msg									("SmartCast stats (different %d, total %d) : ",(u32)m_stats.size(),total);

	I									= m_temp.begin();
	for ( ; I != E; ++I)
		Msg								("%8d %6.2f% : smart_cast<%s>(%s)",(*I).m_count,float((*I).m_count)*100.f/float(total),(*I).m_to,(*I).m_from);
}