Visualizer: Implement region search + highlight

Signed-off-by: Jacob Hilliard <jhlliar@amazon.com>
This commit is contained in:
Jacob Hilliard
2021-07-13 10:21:56 -07:00
parent db8f78890f
commit d5a496751c
2 changed files with 13 additions and 5 deletions
@@ -165,9 +165,11 @@ namespace AZ
AZStd::vector<AZStd::sys_time_t> m_frameEndTicks = { INT64_MIN };
// Main data structure for storing function statistics to be shown in the popup windows.
// For now we default allocate for all regions on the first render frame and then use RegionStatistics.m_draw to determine
// if we should draw the window or not. FIXME(ATOM-15948) this should be changed once RegionStatistics gets heavier.
AZStd::unordered_map<const GroupRegionName*, RegionStatistics> m_regionStatisticsMap;
// Uses the group name + region name as a key - just the region name does not suffice since there are collisions (ex. GarbageCollect)
AZStd::unordered_map<AZStd::string, RegionStatistics> m_regionStatisticsMap;
// Filter for highlighting regions on the visualizer
ImGuiTextFilter m_regionHighlightFilter;
};
} // namespace Render
} // namespace AZ
@@ -279,8 +279,8 @@ namespace AZ
if (ImGui::BeginChild("Options and Statistics", { 0, 0 }, true))
{
ImGui::Columns(3, "Options", true);
ImGui::Text("Frames To Collect:");
ImGui::SliderInt("", &m_framesToCollect, 10, 10000, "%d", ImGuiSliderFlags_AlwaysClamp | ImGuiSliderFlags_Logarithmic);
ImGui::SliderInt("Saved Frames", &m_framesToCollect, 10, 10000, "%d", ImGuiSliderFlags_AlwaysClamp | ImGuiSliderFlags_Logarithmic);
m_regionHighlightFilter.Draw("Find Region");
ImGui::NextColumn();
@@ -522,6 +522,12 @@ namespace AZ
inline void ImGuiCpuProfiler::DrawBlock(const TimeRegion& block, u64 targetRow)
{
// Don't draw anything if the user is searching for regions and this block doesn't pass the filter
if (!m_regionHighlightFilter.PassFilter(block.m_groupRegionName->m_regionName))
{
return;
}
float wy = ImGui::GetWindowPos().y - ImGui::GetScrollY();
ImDrawList* drawList = ImGui::GetWindowDrawList();