Skip to content

Commit

Permalink
[v1.2.5] A bunch of improvements to the UE4 plugin: adding custom men…
Browse files Browse the repository at this point in the history
…u button, fixing a couple a memory stomp if we hit 32 depth of the nested counters, preparing plugin for the release.

Fixing compilation with OPTICK_ENABLE_FIBERS=1.
  • Loading branch information
bombomby committed Jul 28, 2019
1 parent 250959b commit 786c5af
Show file tree
Hide file tree
Showing 22 changed files with 547 additions and 133 deletions.
41 changes: 40 additions & 1 deletion gui/Data/EventFrame.cs
Expand Up @@ -290,7 +290,7 @@ static List<EventData> ReadEventTimeList(BinaryReader reader)
return result;
}

List<Entry> ReadEventList(BinaryReader reader, EventDescriptionBoard board)
public List<Entry> ReadEventList(BinaryReader reader, EventDescriptionBoard board)
{
int count = reader.ReadInt32();
List<Entry> result = new List<Entry>(count);
Expand Down Expand Up @@ -385,4 +385,43 @@ public EventFrame(EventFrame frame, EventNode node) : base(null, frame.Group)
Synchronization = frame.Synchronization;
}
}

public class FrameList
{
public enum Type
{
CPU,
GPU,
Render,
Custom,
}

public List<EventData> Events { get; set; } = new List<EventData>();
public Type FrameType { get; set; }
}

public class FramePack
{
public DataResponse Response { get; set; }
public List<FrameList> Frames { get; set; } = new List<FrameList>();

public static FramePack Create(DataResponse response, EventDescriptionBoard board)
{
FramePack pack = new FramePack();

pack.Response = response;

int frameCount = response.Reader.ReadInt32();
for (int frame = 0; frame < frameCount; ++frame)
{
FrameList list = new FrameList();
list.FrameType = (FrameList.Type)frame;
int count = response.Reader.ReadInt32();
for (int i = 0; i < count; ++i)
list.Events.Add(Entry.Read(response.Reader, board));
pack.Frames.Add(list);
}
return pack;
}
}
}
19 changes: 19 additions & 0 deletions gui/Data/FrameCollection.cs
Expand Up @@ -103,6 +103,7 @@ public class FrameGroup
public List<ThreadData> Fibers { get; set; }
public ThreadData MainThread { get { return Threads[Board.MainThreadIndex]; } }
public SummaryPack Summary { get; set; }
public FramePack Frames { get; set; }
public SynchronizationMap Synchronization { get; set; }

public List<DataResponse> Responses { get; set; }
Expand Down Expand Up @@ -339,6 +340,12 @@ internal void AddSummary(SummaryPack summary)
Summary = summary;
}

public void AddFramePack(FramePack pack)
{
Responses.Add(pack.Response);
Frames = pack;
}

private void SplitFiber(int fiberIndex)
{
ThreadData data = Fibers[fiberIndex];
Expand Down Expand Up @@ -605,6 +612,18 @@ public void Add(DataResponse response)
break;
}


case DataResponse.Type.FramesPack:
{
int id = response.Reader.ReadInt32();
FrameGroup group = groups[id];

FramePack pack = FramePack.Create(response, group.Board);
group.AddFramePack(pack);

break;
}

default:
{
Debug.Fail("Skipping response: ", response.ResponseType.ToString());
Expand Down
1 change: 1 addition & 0 deletions gui/Message/Message.cs
Expand Up @@ -64,6 +64,7 @@ public enum Type
FiberSynchronizationData = 1 << 8,
SyscallPack,
SummaryPack,
FramesPack,
}
public UInt16 ApplicationID { get; set; }
public Type ResponseType { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions gui/Properties/AssemblyInfo.cs
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.4.0")]
[assembly: AssemblyFileVersion("1.2.4.0")]
[assembly: AssemblyVersion("1.2.5.0")]
[assembly: AssemblyFileVersion("1.2.5.0")]
2 changes: 1 addition & 1 deletion gui/TimeLine/TimeLine.xaml.cs
Expand Up @@ -57,7 +57,7 @@ public TimeLine()
this.InitializeComponent();
this.DataContext = frames;

statusToError.Add(TracerStatus.TRACER_ERROR_ACCESS_DENIED, new KeyValuePair<string, string>("ETW can't start: launch your game (or Visual Studio) as administrator to collect context switches", "https://github.com/bombomby/optick/wiki/Event-Tracing-for-Windows"));
statusToError.Add(TracerStatus.TRACER_ERROR_ACCESS_DENIED, new KeyValuePair<string, string>("ETW can't start: launch your Game/VisualStudio/UE4Editor as administrator to collect context switches", "https://github.com/bombomby/optick/wiki/Event-Tracing-for-Windows"));
statusToError.Add(TracerStatus.TRACER_ERROR_ALREADY_EXISTS, new KeyValuePair<string, string>("ETW session already started (Reboot should help)", "https://github.com/bombomby/optick/wiki/Event-Tracing-for-Windows"));
statusToError.Add(TracerStatus.TRACER_FAILED, new KeyValuePair<string, string>("ETW session failed (Run your Game or Visual Studio as Administrator to get ETW data)", "https://github.com/bombomby/optick/wiki/Event-Tracing-for-Windows"));
statusToError.Add(TracerStatus.TRACER_INVALID_PASSWORD, new KeyValuePair<string, string>("Tracing session failed: invalid root password. Run the game as a root or pass a valid password through Optick GUI", "https://github.com/bombomby/optick/wiki/Event-Tracing-for-Windows"));
Expand Down
2 changes: 1 addition & 1 deletion samples/Common/TestEngine/TestEngine.h
Expand Up @@ -4,7 +4,7 @@
#include <thread>

// Inject brofiler code into the task scope
#define MT_SCHEDULER_PROFILER_TASK_SCOPE_CODE_INJECTION( TYPE, DEBUG_COLOR, SRC_FILE, SRC_LINE) OPTICK_CATEGORY( MT_TEXT( #TYPE ), MAKE_CATEGORY(0, DEBUG_COLOR) );
#define MT_SCHEDULER_PROFILER_TASK_SCOPE_CODE_INJECTION( TYPE, DEBUG_COLOR, SRC_FILE, SRC_LINE) OPTICK_CATEGORY( MT_TEXT( #TYPE ), OPTICK_MAKE_CATEGORY(0, DEBUG_COLOR) );

#if !defined(OPTICK_ENABLE_FIBERS)
#define OPTICK_ENABLE_FIBERS (0)
Expand Down
10 changes: 10 additions & 0 deletions samples/UnrealEnginePlugin/Config/FilterPlugin.ini
@@ -0,0 +1,10 @@
[FilterPlugin]
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
;
; Examples:
; /README.txt
; /Extras/...
; /Binaries/ThirdParty/*.dll

/GUI/...
40 changes: 20 additions & 20 deletions samples/UnrealEnginePlugin/OptickPlugin.uplugin
@@ -1,25 +1,25 @@
{
"FileVersion" : 1,
"Version" : 1,
"VersionName" : "1.2.3",
"FriendlyName" : "Optick",
"Description" : "Performance Profiler",
"Category" : "Performance",
"CreatedBy" : "Vadim Slyusarev",
"CreatedByURL" : "https://optick.dev",
"DocsURL" : "",
"MarketplaceURL" : "",
"SupportURL" : "",
"EnabledByDefault" : false,
"CanContainContent" : false,
"IsBetaVersion" : false,
"Installed" : false,
"Modules" :
[
"FileVersion": 3,
"Version": 1,
"VersionName": "1.2.5",
"FriendlyName": "Optick",
"Description": "Super Lightweight Performance Profiler",
"Category": "Performance",
"CreatedBy": "Vadim Slyusarev",
"CreatedByURL": "https://github.com/bombomby/optick",
"DocsURL": "https://github.com/bombomby/optick",
"MarketplaceURL": "",
"SupportURL": "https://github.com/bombomby/optick/issues",
"EngineVersion" : "4.21.0",
"EnabledByDefault": true,
"CanContainContent": false,
"IsBetaVersion": true,
"Installed": true,
"Modules": [
{
"Name" : "OptickPlugin",
"Type" : "Developer",
"LoadingPhase" : "Default"
"Name": "OptickPlugin",
"Type": "Developer",
"LoadingPhase": "Default"
}
]
}
Binary file modified samples/UnrealEnginePlugin/Resources/Icon128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion samples/UnrealEnginePlugin/Source/OptickPlugin.Build.cs
Expand Up @@ -51,13 +51,27 @@ public OptickPlugin(ReadOnlyTargetRules Target) : base(Target)
{
"OPTICK_ENABLE_GPU_VULKAN=0",
"OPTICK_ENABLE_GPU_D3D12=0",
"OPTICK_UE4=1",
}
);


if (Target.bBuildEditor == true)
{
PrivateDependencyModuleNames.Add("UnrealEd");
PublicDependencyModuleNames.AddRange(
new string[]
{
"Slate",
"SlateCore",
"EditorStyle",
"UnrealEd",
"MainFrame",
"GameProjectGeneration",
"Projects",
"InputCore",
"LevelEditor",
}
);
}
//PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
}
Expand Down
10 changes: 10 additions & 0 deletions samples/UnrealEnginePlugin/Source/Private/OptickCommands.cpp
@@ -0,0 +1,10 @@
#include "OptickCommands.h"

#define LOCTEXT_NAMESPACE "FOptickModule"

void FOptickCommands::RegisterCommands()
{
UI_COMMAND(PluginAction, "Optick", "Open Optick Profiler", EUserInterfaceActionType::Button, FInputGesture());
}

#undef LOCTEXT_NAMESPACE
21 changes: 21 additions & 0 deletions samples/UnrealEnginePlugin/Source/Private/OptickCommands.h
@@ -0,0 +1,21 @@
#pragma once

#include "Slate/Public/Framework/Commands/Commands.h"

#include "OptickStyle.h"

class FOptickCommands : public TCommands<FOptickCommands>
{
public:

FOptickCommands()
: TCommands<FOptickCommands>(TEXT("Optick"), NSLOCTEXT("Contexts", "Optick", "Optick Plugin"), NAME_None, FOptickStyle::GetStyleSetName())
{
}

// TCommands<> interface
virtual void RegisterCommands() override;

public:
TSharedPtr< FUICommandInfo > PluginAction;
};

0 comments on commit 786c5af

Please sign in to comment.