// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreTypes.h" // TraceInsights #include "Insights/ITimingViewSession.h" // for ETimeChangedFlags #include "Insights/Widgets/SMajorTabWindow.h" namespace UE::Insights { class SLogView; } namespace UE::Insights::TimingProfiler { class SFrameTrack; class SStatsView; class STimersView; class STimerTreeView; class STimingView; /** Implements the Timing Insights major tab window. */ class STimingProfilerWindow : public ::Insights::SMajorTabWindow { public: /** Default constructor. */ STimingProfilerWindow(); /** Virtual destructor. */ virtual ~STimingProfilerWindow(); SLATE_BEGIN_ARGS(STimingProfilerWindow) {} SLATE_END_ARGS() virtual void Reset() override; /** Constructs this widget. */ void Construct(const FArguments& InArgs, const TSharedRef& ConstructUnderMajorTab, const TSharedPtr& ConstructUnderWindow); TSharedPtr GetTimingView() const { return TimingView; } TSharedPtr GetTimersView() const { return TimersView; } TSharedPtr GetCallersTreeView() const { return CallersTreeView; } TSharedPtr GetCalleesTreeView() const { return CalleesTreeView; } TSharedPtr GetStatsView() const { return StatsView; } TSharedPtr GetLogView() const { return LogView; } TSharedPtr GetFrameView() const { return FrameTrack; } /** Gets the color of a given timer, returns true if successful, false if the timer was not found. */ bool GetTimerColor(uint32 TimerId, FLinearColor& OutColor); /** Updates the TMap and propagates the color to any relevant graphs and nodes. */ void SetTimerColor(uint32 TimerId, FLinearColor Color); bool IsTimerAddedToGraphs(uint32 TimerId) const; void OnTimerAddedToGraphsChanged(uint32 TimerId); protected: virtual const TCHAR* GetAnalyticsEventName() const override; virtual TSharedRef CreateWorkspaceMenuGroup() override; virtual void RegisterTabSpawners() override; virtual TSharedRef CreateDefaultTabLayout() const override; virtual TSharedRef CreateToolbar(TSharedPtr Extender); private: TSharedRef SpawnTab_FramesTrack(const FSpawnTabArgs& Args); void OnFramesTrackTabClosed(TSharedRef TabBeingClosed); TSharedRef SpawnTab_TimingView(const FSpawnTabArgs& Args); void OnTimingViewTabClosed(TSharedRef TabBeingClosed); TSharedRef SpawnTab_Timers(const FSpawnTabArgs& Args); void OnTimersTabClosed(TSharedRef TabBeingClosed); TSharedRef SpawnTab_Callers(const FSpawnTabArgs& Args); void OnCallersTabClosed(TSharedRef TabBeingClosed); TSharedRef SpawnTab_Callees(const FSpawnTabArgs& Args); void OnCalleesTabClosed(TSharedRef TabBeingClosed); TSharedRef SpawnTab_StatsCounters(const FSpawnTabArgs& Args); void OnStatsCountersTabClosed(TSharedRef TabBeingClosed); TSharedRef SpawnTab_LogView(const FSpawnTabArgs& Args); void OnLogViewTabClosed(TSharedRef TabBeingClosed); void OnTimeSelectionChanged(Timing::ETimeChangedFlags InFlags, double InStartTime, double InEndTime); private: /** The Frame track widget */ TSharedPtr FrameTrack; /** The Timing view (multi-track) widget */ TSharedPtr TimingView; /** The Timers view widget */ TSharedPtr TimersView; /** The Callers tree view widget */ TSharedPtr CallersTreeView; /** The Callees tree view widget */ TSharedPtr CalleesTreeView; /** The Stats (Counters) view widget */ TSharedPtr StatsView; /** The Log view widget */ TSharedPtr LogView; /** Color-TimerId Mapping for easy pairing */ TMap TimerColors; }; } // namespace UE::Insights::TimingProfiler