2019-12-26 15:32:37 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "Misc/Attribute.h"
|
|
|
|
|
#include "Widgets/SWidget.h"
|
|
|
|
|
#include "Widgets/DeclarativeSyntaxSupport.h"
|
|
|
|
|
#include "Widgets/SCompoundWidget.h"
|
|
|
|
|
#include "Widgets/Views/STableViewBase.h"
|
|
|
|
|
#include "Widgets/Views/STableRow.h"
|
|
|
|
|
#include "Widgets/Views/STreeView.h"
|
|
|
|
|
#include "VisualizerEvents.h"
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/**
|
|
|
|
|
* Item used in task graph events list
|
|
|
|
|
*/
|
|
|
|
|
class TASKGRAPH_API SEventItem : public SMultiColumnTableRow< TSharedPtr< FVisualizerEvent > >
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
SLATE_BEGIN_ARGS( SEventItem )
|
|
|
|
|
: _EventName()
|
|
|
|
|
, _EventDuration(0.0)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SLATE_ARGUMENT( FString, EventName )
|
|
|
|
|
|
|
|
|
|
SLATE_ATTRIBUTE( double, EventDuration )
|
|
|
|
|
|
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generates a widget for task graph events list column
|
|
|
|
|
*
|
|
|
|
|
* @param InArgs A declaration from which to construct the widget
|
|
|
|
|
*/
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual TSharedRef< SWidget > GenerateWidgetForColumn( const FName& ColumnName ) override;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Construct the widget
|
|
|
|
|
*
|
|
|
|
|
* @param InArgs A declaration from which to construct the widget
|
|
|
|
|
*/
|
|
|
|
|
void Construct( const FArguments& InArgs, const TSharedRef<STableViewBase>& InOwnerTableView );
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
2015-01-07 09:52:40 -05:00
|
|
|
FText GetDurationText() const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-01-07 09:52:40 -05:00
|
|
|
static const FNumberFormattingOptions DurationFormatOptions = FNumberFormattingOptions()
|
|
|
|
|
.SetMinimumFractionalDigits(2)
|
|
|
|
|
.SetMaximumFractionalDigits(2);
|
|
|
|
|
return FText::AsNumber(EventDuration.Get(), &DurationFormatOptions);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FString EventName;
|
|
|
|
|
TAttribute< double > EventDuration;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Profiler events tree. Contains a tree of profiler event for the selected graph bar.
|
|
|
|
|
*/
|
|
|
|
|
class TASKGRAPH_API SEventsTree : public SCompoundWidget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/** Delegate used when the selection changes */
|
|
|
|
|
DECLARE_DELEGATE_OneParam( FOnEventSelectionChanged, TSharedPtr< FVisualizerEvent > );
|
|
|
|
|
|
|
|
|
|
SLATE_BEGIN_ARGS( SEventsTree )
|
|
|
|
|
: _ProfileData()
|
|
|
|
|
, _OnEventSelectionChanged()
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
/** Profiler data */
|
|
|
|
|
SLATE_ATTRIBUTE( TSharedPtr< FVisualizerEvent >, ProfileData )
|
|
|
|
|
|
|
|
|
|
/** Event for handling selection changes */
|
|
|
|
|
SLATE_EVENT( FOnEventSelectionChanged, OnEventSelectionChanged )
|
|
|
|
|
|
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Construct the widget
|
|
|
|
|
*
|
|
|
|
|
* @param InArgs A declaration from which to construct the widget
|
|
|
|
|
*/
|
|
|
|
|
void Construct( const FArguments& InArgs );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function called when the currently selected bar graph changes
|
|
|
|
|
*
|
|
|
|
|
* @param Selection Currently selected bar graph
|
|
|
|
|
*/
|
|
|
|
|
void HandleBarGraphSelectionChanged( TSharedPtr< FVisualizerEvent > Selection );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function called when the currently expanded bar graph changes
|
|
|
|
|
*
|
|
|
|
|
* @param Selection Currently expanded bar graph
|
|
|
|
|
*/
|
|
|
|
|
void HandleBarGraphExpansionChanged( TSharedPtr< FVisualizerEvent > Selection );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function called when the user selects an event bar in the graph
|
|
|
|
|
*
|
|
|
|
|
* @param Selection Currently selected event
|
|
|
|
|
*/
|
|
|
|
|
void HandleBarEventSelectionChanged( int32 Thread, TSharedPtr< FVisualizerEvent > Selection );
|
|
|
|
|
|
|
|
|
|
/** Gets a label for this events tree tab */
|
|
|
|
|
FString GetTabTitle() const;
|
|
|
|
|
|
|
|
|
|
/** Name of 'Name' column */
|
|
|
|
|
static FName NAME_NameColumn;
|
|
|
|
|
|
|
|
|
|
/** Name of 'Duration' column */
|
|
|
|
|
static FName NAME_DurationColumn;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function called when the currently selected event in the list of thread events changes
|
|
|
|
|
*
|
|
|
|
|
* @param Selection Currently selected event
|
|
|
|
|
* @param SelectInfo Provides context on how the selection changed
|
|
|
|
|
*/
|
|
|
|
|
void OnEventSelectionChanged( TSharedPtr< FVisualizerEvent > Selection, ESelectInfo::Type SelectInfo );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generates SEventItem widgets for the events tree
|
|
|
|
|
*
|
|
|
|
|
* @param InItem Event to generate SEventItem for
|
|
|
|
|
* @param OwnerTable Owner Table
|
|
|
|
|
*/
|
|
|
|
|
TSharedRef< ITableRow > OnGenerateWidgetForEventsList( TSharedPtr< FVisualizerEvent > InItem, const TSharedRef< STableViewBase >& OwnerTable );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Given a profiler event, generates children for it
|
|
|
|
|
*
|
|
|
|
|
* @param InItem Event to generate children for
|
|
|
|
|
* @param OutChildren Generated children
|
|
|
|
|
*/
|
|
|
|
|
void OnGetChildrenForEventsList( TSharedPtr<FVisualizerEvent> InItem, TArray<TSharedPtr<FVisualizerEvent> >& OutChildren );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handles column sorting mode change
|
|
|
|
|
*
|
|
|
|
|
* @param InSortMode New sorting mode
|
|
|
|
|
*/
|
Asset View now supports secondary sorting
#UDN: Feature suggestion; Content browser can sort by a second column
#branch UE4
#change
Added two new images for secondary sort ascending and descending.
(Updated styles where needed).
Added new enum EColumnSortPriority: currently only lists Primary and Secondary, but can easily accommodate more*.
(FOnSortModeChanged was modified to also have the priority as a param, fixedup existing usage).
SHeaderRow now also has a SortPriority attribute to specify the SortMode order
(Defaults to Primary if unused).
Modified TUniquePtr so that assigning one from another worked correctly.
(Reviewed by Steve Robb).
SAssetView is the only table that has been modified, so far, to take advantage of the secondary sort. SetMajorityAssetType has been updated to correctly filter out all those sorts which are no longer relevant and bump the priority of the remaining sorts to fill in the ægapsÆ made by non-longer-relevant ones.
FAssetViewSortManager has been overhauled to take SortPriority into consideration when sortingÃ
Firstly, duplicate comparison structs were removed in favour of single structs which have æascendingÆ as a paramà any remaining duplicate code was removed in favour of an inherited usage. The base struct has an array of æfurther methodsÆ to employ in the result of a tie. Should a tie occur the ænextÆ comparison is done, and so on until itÆs not a tie or we run out of comparisons to perform.*
The manager defaults to having no secondary sort, so it relies on the interface thatÆs using it to provide it.
Whenever a column is assign the code makes sure that itÆs not already assigned to another column and corrects the order to take this into account.
Fixed a bug in FCompareFAssetItemByTagNumericalAscending comparing A with A (instead of B).
Various optimizations to the sort to descrease times
*The only places æSecondaryÆ is referred to in code is in GetSortingBrush (so it can display the correct icon for the sort), and OnTitleClicked (so it can set to correct sort based on input). The sorting code itself has no concept as to a secondary sort, it can support any number of sorting levels so if in future a tertiary (or more) is added, it is only these two function which should need updating as the sort will automatically accommodate it.
reviewed by Thomas.Sarkanen, Bob.Tellez
[CL 2119201 by Andrew Brown in Main branch]
2014-06-27 04:30:08 -04:00
|
|
|
void OnColumnSortModeChanged( const EColumnSortPriority::Type SortPriority, const FName& ColumnId, const EColumnSortMode::Type InSortMode );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Returns the current sort mode of the specified column
|
|
|
|
|
*/
|
|
|
|
|
EColumnSortMode::Type GetColumnSortMode( const FName ColumnId );
|
|
|
|
|
|
|
|
|
|
/** Sorts the selected events tree */
|
|
|
|
|
void SortEventsList( void );
|
|
|
|
|
|
|
|
|
|
/** Recursively sorts the selected events tree */
|
|
|
|
|
void SortEventsList( TArray< TSharedPtr< FVisualizerEvent > >& Events );
|
|
|
|
|
|
|
|
|
|
/** Restores event selection after changes to the tree */
|
|
|
|
|
bool RestoreEventSelection( TArray< TSharedPtr< FVisualizerEvent > >& Events );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets 'Duration' column time units
|
|
|
|
|
*
|
|
|
|
|
* @param InUnits New units
|
|
|
|
|
*/
|
|
|
|
|
void SetDurationUnits( EVisualizerTimeUnits::Type InUnits );
|
|
|
|
|
|
|
|
|
|
/** Recursively counts all events in the tree */
|
|
|
|
|
int32 CountEvents( TArray< TSharedPtr< FVisualizerEvent > >& Events );
|
|
|
|
|
|
|
|
|
|
/** Given the selected events from the bar graph creates a copy of the selection applying the current view and sorting mode */
|
|
|
|
|
void CreateSelectedEventsView();
|
|
|
|
|
|
|
|
|
|
/** Helper function for creating a copy of the selected events in a hierarchy */
|
|
|
|
|
TSharedPtr< FVisualizerEvent > CreateSelectedEventsViewRecursively( TSharedPtr< FVisualizerEvent > SourceEvent );
|
|
|
|
|
|
|
|
|
|
/** Helper function for creating a copy of the selected events and flattening the hierarchy */
|
|
|
|
|
void CreateSelectedEventsViewRecursivelyAndFlatten( TSharedPtr< FVisualizerEvent > SourceEvent );
|
|
|
|
|
|
|
|
|
|
/** Helper function for creating a copy of the selected events combining leaves with the same name */
|
|
|
|
|
void CreateSelectedEventsViewRecursivelyCoalesced( TArray< TSharedPtr< FVisualizerEvent > >& SourceEvents, TArray< TSharedPtr< FVisualizerEvent > >& CopiedEvents, TSharedPtr< FVisualizerEvent > InParent );
|
|
|
|
|
|
|
|
|
|
/** Helper function for creating a copy of the selected events combining leaves with the same name and flattening the hierarchy */
|
|
|
|
|
void CreateSelectedEventsViewRecursivelyFlatCoalesced( TArray< TSharedPtr< FVisualizerEvent > >& SourceEvents );
|
|
|
|
|
|
|
|
|
|
/** Gets the currently selected time units */
|
|
|
|
|
bool CheckDurationUnits( EVisualizerTimeUnits::Type InUnits ) const
|
|
|
|
|
{
|
|
|
|
|
return (InUnits == DurationUnits);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the current view mode
|
|
|
|
|
*
|
|
|
|
|
* @param InMode New view mode
|
|
|
|
|
*/
|
|
|
|
|
void SetViewMode( EVisualizerViewMode::Type InMode );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Given a view mode checks if it's the currently selected one
|
|
|
|
|
*
|
|
|
|
|
* @param InMode View mode to check
|
|
|
|
|
*/
|
|
|
|
|
bool CheckViewMode( EVisualizerViewMode::Type InMode ) const
|
|
|
|
|
{
|
|
|
|
|
return (ViewMode == InMode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts ms to currently selected time units.
|
|
|
|
|
*
|
|
|
|
|
* @param InDurationMs duration time in ms.
|
|
|
|
|
*/
|
|
|
|
|
double GetEventDuration( double InDurationMs ) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Called by the editable text control when the filter text is changed by the user
|
|
|
|
|
*
|
|
|
|
|
* @param InFilterText The new text
|
|
|
|
|
*/
|
|
|
|
|
void OnFilterTextChanged( const FText& InFilterText );
|
|
|
|
|
|
|
|
|
|
/** Called by the editable text control when a user presses enter or commits their text change */
|
|
|
|
|
void OnFilterTextCommitted( const FText& InFilterText, ETextCommit::Type CommitInfo );
|
|
|
|
|
|
|
|
|
|
/** Checks if event name passes current filter */
|
|
|
|
|
bool FilterEvent( TSharedPtr< FVisualizerEvent > InEvent ) const
|
|
|
|
|
{
|
|
|
|
|
// Filter only leaves, we want to keep the hierarchy
|
|
|
|
|
return InEvent->Children.Num() > 0 || FilterText.Len() == 0 || InEvent->EventName.StartsWith( FilterText );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Gets the currently selected time units text */
|
2014-11-26 12:46:05 -05:00
|
|
|
FText GetDurationColumnTitle() const;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/** A pointer to the ListView of profiler events */
|
|
|
|
|
TSharedPtr< STreeView< TSharedPtr< FVisualizerEvent > > > EventsListView;
|
|
|
|
|
|
|
|
|
|
/** Original profiler data */
|
|
|
|
|
TSharedPtr< FVisualizerEvent > ProfileData;
|
|
|
|
|
|
|
|
|
|
/** Currently selected events for this tree */
|
|
|
|
|
TSharedPtr< FVisualizerEvent > SelectedThread;
|
|
|
|
|
|
|
|
|
|
/** List of events for the currently selected thread */
|
|
|
|
|
TArray< TSharedPtr< FVisualizerEvent > > SelectedEvents;
|
|
|
|
|
|
|
|
|
|
/** List of events for the currently selected thread */
|
|
|
|
|
TArray< TSharedPtr< FVisualizerEvent > > SelectedEventsView;
|
|
|
|
|
|
|
|
|
|
/** Maps the events generated using currently selected view and sorting modes to the source events tree */
|
|
|
|
|
TMap< TSharedPtr< FVisualizerEvent >, TSharedPtr< FVisualizerEvent > > ViewToEventsMap;
|
|
|
|
|
|
|
|
|
|
/** Delegate used to notify when event selection changes */
|
|
|
|
|
FOnEventSelectionChanged OnEventSelectionChangedDelegate;
|
|
|
|
|
|
|
|
|
|
/** Specify which column to sort with */
|
|
|
|
|
FName SortByColumn;
|
|
|
|
|
|
|
|
|
|
/** Currently selected sorting mode */
|
|
|
|
|
EColumnSortMode::Type SortMode;
|
|
|
|
|
|
|
|
|
|
/** Currently selected time units */
|
|
|
|
|
EVisualizerTimeUnits::Type DurationUnits;
|
|
|
|
|
|
|
|
|
|
/** Currently selected view mode */
|
|
|
|
|
EVisualizerViewMode::Type ViewMode;
|
|
|
|
|
|
|
|
|
|
/** Events filter text */
|
|
|
|
|
FString FilterText;
|
|
|
|
|
|
|
|
|
|
/** Suppresses SelectionChanged delegate to avoid event loops between graph visualizer and events tree */
|
|
|
|
|
bool bSuppressSelectionChangedEvent;
|
|
|
|
|
};
|