3636#include " AdvancedMath.hpp"
3737#include " PBR_Renderer.hpp"
3838#include " FileSystem.hpp"
39+ #include " Timer.hpp"
40+
3941#include " Tasks/HnReadRprimIdTask.hpp"
4042#include " Tasks/HnRenderAxesTask.hpp"
4143#include " HnTokens.hpp"
@@ -330,6 +332,8 @@ void USDViewer::Render()
330332 if (!m_Stage)
331333 return ;
332334
335+ Timer Stowatch;
336+
333337 m_Stage.Camera ->SetViewMatrix (m_CameraView);
334338 m_Stage.Camera ->SetProjectionMatrix (m_CameraProj);
335339
@@ -358,6 +362,8 @@ void USDViewer::Render()
358362 m_Stats.NumTriangles = CtxStats.GetTotalTriangleCount ();
359363 m_Stats.NumLines = CtxStats.GetTotalLineCount ();
360364 m_Stats.NumPoints = CtxStats.GetTotalPointCount ();
365+
366+ m_Stats.TaskRunTime = static_cast <float >(Stowatch.GetElapsedTime ()) * 0 .05f + m_Stats.TaskRunTime * 0 .95f ;
361367}
362368
363369void USDViewer::PopulateSceneTree (const pxr::UsdPrim& Prim)
@@ -687,7 +693,8 @@ void USDViewer::UpdateUI()
687693 if (ImGui::BeginTabItem (" Stats" ))
688694 {
689695 const auto MemoryStats = m_Stage.RenderDelegate ->GetMemoryStats ();
690- ImGui::TextDisabled (" Num draws\n "
696+ ImGui::TextDisabled (" Task time\n "
697+ " Num draws\n "
691698 " Tris\n "
692699 " Lines\n "
693700 " Points\n "
@@ -708,7 +715,8 @@ void USDViewer::UpdateUI()
708715 const std::string IndPoolCommittedSizeStr = GetMemorySizeString (MemoryStats.IndexPool .CommittedSize ).c_str ();
709716 const std::string IndPoolUsedSizeStr = GetMemorySizeString (MemoryStats.IndexPool .UsedSize ).c_str ();
710717 const std::string AtlasCommittedSizeStr = GetMemorySizeString (MemoryStats.Atlas .CommittedSize ).c_str ();
711- ImGui::TextDisabled (" %d\n "
718+ ImGui::TextDisabled (" %.1f ms\n "
719+ " %d\n "
712720 " %d\n "
713721 " %d\n "
714722 " %d\n "
@@ -722,6 +730,7 @@ void USDViewer::UpdateUI()
722730 " %s / %s (%d allocs, %dK verts)\n "
723731 " %s / %s (%d allocs)\n "
724732 " %s (%.1lf%%, %d allocs)" ,
733+ m_Stats.TaskRunTime * 1000 .f ,
725734 m_Stats.NumDrawCommands ,
726735 m_Stats.NumTriangles ,
727736 m_Stats.NumLines ,
0 commit comments