コード例 #1
0
ファイル: ProfNode.cpp プロジェクト: ClementVidal/sable.sable
CProfileNode * CProfileNode::GetChild( UInt32 index )
{
    UInt32 i=0;
    CProfileNode * child = m_Child;
    while( child )
    {
        if( i == index )
            return child;
        i++;
        child = child->GetSibling();
    }

    return NULL;
}
コード例 #2
0
ファイル: ProfNode.cpp プロジェクト: ClementVidal/sable.sable
Void	CProfileNode::Reset()
{
	m_TotalCalls = 0;
	m_TotalSamplingTime = 0;
	m_RecursionCounter = 0;
	m_SamplingStart = 0;

    CProfileNode* tmp = m_Child;
	while( tmp ) 
	{
		tmp->Reset();
        tmp = tmp->GetSibling();
	}
    m_Child = NULL;
}
コード例 #3
0
ファイル: profile.cpp プロジェクト: weimingtom/xgame
IProfileNode * CProfileNode::GetSubNode( const char * name )
{
    CProfileNode * child = Child;
    while ( child )
    {
#ifdef NO_STR_CPY
        if(child->Name == name) {
#else
        if ( strcmp(child->Name , name ) == 0) {
#endif
            return child;
        }
        child = child->Sibling;
    }
    CProfileNode * node = new CProfileNode( name, this );
    CProfileNode *pTemp = Child;
    CProfileNode *pPre = 0;
    while(pTemp)
    {
        pPre = pTemp;
        pTemp = (CProfileNode*)pTemp->GetSibling();
    }
    if(pPre)
    {
        pPre->Sibling = node;
    }
    else
    {
        Child = node;
    }
    return node;
}


void	CProfileNode::Reset( void )
{
    TotalCalls = 0;
    TotalTime = 0.0f;
    MinTime = (float)_I64_MAX;
    MaxTime = 0;

    if ( Child ) {
        Child->Reset();
    }
    if ( Sibling ) {
        Sibling->Reset();
    }
}
コード例 #4
0
ファイル: ProfView.cpp プロジェクト: ClementVidal/sable.sable
Void CDebugProfView::Format( )
{
	DebugProfile( "CDebugProfView::Format" );
	
	String parentName;

#ifndef SETUP_USE_PROF
	m_Buffer[0] = 0;
	return ;
#endif

	Char* buffer = m_Buffer.GetBuffer();
	Int32 s = m_Buffer.GetItemCount();
	Int32 off;
	UInt32 frameCount = CoreManager.GetDebugProf().GetSampledFrameCount();

	parentName = m_CurrentNode->GetName();

	off = StringSetFormattedText( buffer, s,"| Profiling Data | Depth Level: %d    \n" \
											"| Parent: %s \n" \
											"-----------------------------------------------------\n", 
											m_NavigationHistory.GetItemCount(), parentName );
	buffer += off;

	Float32 selfTotalTime = 0.0f;
	Float32 parentTotalTime = 0.0f;

	if( frameCount >= PROFVIEW_FRAMEDELAY )
	{
        CProfileNode* childNode = NULL;

		parentTotalTime = m_CurrentNode->GetTotalSamplingTime() / (Float32) frameCount; 
	
		m_EntryCount = 0;

		Float32 time;
		Int32 percent;

        childNode = m_CurrentNode->GetChild();
		while( childNode )
		{
			time = childNode->GetTotalSamplingTime();
			time = time / (Float32) frameCount; 

			selfTotalTime += time;
			childNode = childNode->GetSibling();
		}

		childNode = m_CurrentNode->GetChild();
		while( childNode )
		{
			time = childNode->GetTotalSamplingTime()/ (Float32) frameCount;
			if( parentTotalTime > 0.0f )
				percent = ( Int32 ) ( time / parentTotalTime * 100.0f );
			else
				percent = 0;

			if( m_EntryCount != m_SelectionMark )
				off = StringSetFormattedText( buffer, s, "|  %s : %.5f ms %d %%\n", childNode->GetName(), time * 1000.0f, percent );
			else
				off = StringSetFormattedText( buffer, s, "|>> %s : %.5f ms %d %%\n", childNode->GetName(), time * 1000.0f, percent );

			buffer += off;

			m_EntryCount++;
			childNode = childNode->GetSibling();
		}
	}
	else
	{
		off = StringSetFormattedText( buffer, s, "Sampling...\n");
		buffer += off;
	}

	Float32 totalTime = parentTotalTime;
	Float32 profiledTime = selfTotalTime;
	Float32 unProfiledTime = parentTotalTime - selfTotalTime;
	if( unProfiledTime < 0 )
		unProfiledTime = 0;

	off = StringSetFormattedText( buffer, s, "-----------------------------------------------------\n");
	buffer += off;
	off = StringSetFormattedText( buffer, s, "| Total time: %.5f ms \n", totalTime * 1000.0f );
	buffer += off;
	off = StringSetFormattedText( buffer, s, "| Profiled time: %.5f ms \n", profiledTime * 1000.0f );
	buffer += off;
	off = StringSetFormattedText( buffer, s, "| UnProfiled time: %.5f ms \n", unProfiledTime * 1000.0f );
	buffer += off;

}