本文整理汇总了C++中Profiler::Advance方法的典型用法代码示例。如果您正苦于以下问题:C++ Profiler::Advance方法的具体用法?C++ Profiler::Advance怎么用?C++ Profiler::Advance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profiler
的用法示例。
在下文中一共展示了Profiler::Advance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void SoundProfileWindow::Render( bool hasFocus )
{
DarwiniaWindow::Render( hasFocus );
#ifdef PROFILER_ENABLED
int xPos = m_x + 15;
int yPos = m_y + 40;
int yDif = 13;
int textSize = DEF_FONT_SIZE;
//
// Print Main Profiles
float total = 0.0f;
{
Profiler *profiler = g_app->m_soundSystem->m_mainProfiler;
float maxTime = profiler->m_rootElement->GetMaxChildTime() * 1000.0f;
int i = profiler->m_rootElement->m_children.StartOrderedWalk();
while (i != -1)
{
ProfiledElement *pe = profiler->m_rootElement->m_children[i];
float time = float( pe->m_lastTotalTime * 1000.0f );
float timePerCall = 0.0f;
if( pe->m_lastNumCalls > 0 )
{
timePerCall = time/(float)pe->m_lastNumCalls;
}
char caption[256];
sprintf( caption, "%-28s:%3dx%2.1f = %2.0f %2.0f",
pe->m_name,
pe->m_lastNumCalls,
timePerCall,
time,
pe->m_historyTotalTime * 1000.0 / pe->m_historyNumSeconds);
float colour = 0.5f + 0.5f * time / maxTime;
glColor4f( colour, colour, colour, 1.0f );
g_editorFont.DrawText2D( xPos, yPos+=yDif, textSize, caption );
total += time;
i = profiler->m_rootElement->m_children.GetNextOrderedIndex();
}
ProfiledElement *pe = g_app->m_profiler->m_rootElement->m_children.GetData("Advance SoundSystem");
float advanceTime = pe->m_lastTotalTime * 1000.0f;
float other = advanceTime - total;
if( other < 0 ) other = 0;
float colour = 0.5f + 0.5f * other / maxTime;
glColor4f( colour, colour, colour, 1.0f );
g_editorFont.DrawText2D( xPos, yPos+=yDif, textSize, "Other : = %2.0f", other );
total += other;
}
yPos = m_y + 300;
//
// Print Event Profiles
{
Profiler *profiler = g_app->m_soundSystem->m_eventProfiler;
float maxTime = profiler->m_rootElement->GetMaxChildTime() * 1000.0f;
float total = 0.0f;
if (maxTime < 1e-6) maxTime = 1e-6;
int i = profiler->m_rootElement->m_children.StartOrderedWalk();
while (i != -1)
{
ProfiledElement *pe = profiler->m_rootElement->m_children[i];
float time = float( pe->m_lastTotalTime * 1000.0f );
float timePerCall = 0.0f;
if( pe->m_lastNumCalls > 0 )
{
timePerCall = time/(float)pe->m_lastNumCalls;
}
char caption[256];
sprintf( caption, "%-28s:%3dx%2.1f = %2.0f %2.0f",
pe->m_name,
pe->m_lastNumCalls,
timePerCall,
time,
pe->m_historyTotalTime * 1000.0 / pe->m_historyNumSeconds);
float colour = 0.5f + 0.5f * time / maxTime;
glColor4f( colour, colour, colour, 1.0f );
g_editorFont.DrawText2D( xPos, yPos+=yDif, textSize, caption );
total += time;
i = profiler->m_rootElement->m_children.GetNextOrderedIndex();
}
}
//
//.........这里部分代码省略.........