【目标】
统计指令数影响耗时
【思路】
1 相同模型,换材质之后
2 看下ShaderComplexity

配置文件中

usf中计算颜色方式

也就是越复杂,就颜色 绿->红->白
3 耗时统计显示
将有用的集合起来吧
4 每个Component的耗时
5 添加一列百分比,用于选中某一列排序时,进行百分比计算

6 WxTextureStatsBrowser这个是做啥的??
WxGameStatsVisualizer ?
7

上面的耗时统计方法
appCycle
计算公式
GSecondsPerCycle * 1000.f * dwTimes

【步骤】
1 添加一列Percent
下图

2 WxPrimitiveStatsBrowser.UpdatePercentList.
void WxPrimitiveStatsBrowser::UpdatePercentList(UBOOL bResizeColumns/*=TRUE*/){BeginUpdate();ListControl->Freeze();{INT nCount = ListControl->GetItemCount();//Get the aggregate countwxListItem ItemData;ItemData.SetId(0);// 行ItemData.SetColumn(WxPrimitiveStatsBrowser::PrimarySortIndex);ItemData.SetMask(wxLIST_MASK_TEXT);ListControl->GetItem(ItemData);//Get the valueFString TotalValue = ItemData.GetText();// Strip offINT NameStartIndex = TotalValue.InStr(TEXT(","));while(NameStartIndex != INDEX_NONE){TotalValue = TotalValue.Left(NameStartIndex)+ TotalValue.RightChop(NameStartIndex+1);NameStartIndex = TotalValue.InStr(TEXT(","));}INT nTotalValue = appAtoi(*TotalValue);for( INT RowIndex=0; RowIndex<nCount; RowIndex++ ){//Get the aggregate countwxListItem ItemData;ItemData.SetId(RowIndex);// 行ItemData.SetColumn(WxPrimitiveStatsBrowser::PrimarySortIndex);ItemData.SetMask(wxLIST_MASK_TEXT);ListControl->GetItem(ItemData);//Get the value//Get the valueFString ItemValue = ItemData.GetText();// Strip offINT NameStartIndex = ItemValue.InStr(TEXT(","));while(NameStartIndex != INDEX_NONE){ItemValue = ItemValue.Left(NameStartIndex) + ItemValue.RightChop(NameStartIndex+1);NameStartIndex = ItemValue.InStr(TEXT(","));}INT nValue = appAtoi(*ItemValue);FLOAT Percent = (FLOAT)nValue / (FLOAT)nTotalValue;ListControl->SetItem( RowIndex, PCSBC_Percent, *FString::Printf(TEXT("%.3f%%"),Percent* 100.f) ); // Percent}// Set proper column width.if(bResizeColumns == TRUE){SetAutoColumnWidth();}}ListControl->Thaw();EndUpdate();}

3 测试StaticMesh的时间消耗统计,在TStaticMeshDrawList.DrawElement 中
#if STATS...// Grab our start timeDWORD StartCycles = appCycles();#endif....#if STATS// thread while be updated by this threadElement.Mesh->PrimitiveSceneInfo->Component->DrawTimes += (appCycles() - StartCycles) * GSecondsPerCycle * 1000.f;#endif

4 把它显示列表中

5

图中Stat面板统计的DrawCall数量和DrawTimes于Stat指令统计的有出入
6 添加分类统计,添加隐藏显示勾选


7