You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Start the UnrealTrace server implicitly when non-programs launch, and when external platforms are launched through UAT.
#rb jb #rnx [CL 16603787 by Martin Ridgers in ue5-main branch]
This commit is contained in:
@@ -14952,6 +14952,7 @@
|
||||
<File Name="Engine/Binaries/Win64/EpicWebHelper.exe" Hash="ece52e73c20fc3036f7d051a6794e5dca5db853a" IsExecutable="true" />
|
||||
<File Name="Engine/Binaries/Win64/LiveCodingConsole.exe" Hash="b842c00c09faedd210caf5ffb02361d7757bdfb1" IsExecutable="true" />
|
||||
<File Name="Engine/Binaries/Win64/MinidumpDiagnostics.exe" Hash="844f7c3605956a31fbbd33da3ef0e9d1f032acf5" />
|
||||
<File Name="Engine/Binaries/Win64/UnrealTrace.exe" Hash="b667cd5a5041e8a4c7696c29c04c14b4a1959bf7" IsExecutable="true" />
|
||||
<File Name="Engine/Binaries/Win64/UnrealVersionSelector-Win64-Shipping.exe" Hash="51f8f10af2e90c4c0ebfea2499087901dc6eeecc" IsExecutable="true" />
|
||||
<File Name="Engine/Binaries/Win64/embree.dll" Hash="9356f9c653f23fd2d3c970fde552b47955eaee96" />
|
||||
<File Name="Engine/Binaries/Win64/fbxsdk-2013.3.dll" Hash="25a80d03202fc62be782b96655850f7edcdf2ee9" />
|
||||
@@ -107360,6 +107361,7 @@
|
||||
<Blob Hash="b6658621430677d147ecd3b80b51553c27139320" Size="179552" PackHash="2d5fa005fcf11c4e0c6d69b5ad70d28e530d3238" PackOffset="574698" />
|
||||
<Blob Hash="b6675e1dacff54c85b7cb891fd6a53604402d160" Size="1580" PackHash="0a79b68fc843ff09e7eeffe5fafe58c90b6ece69" PackOffset="813708" />
|
||||
<Blob Hash="b66768cae4956c40933ff95cc19c0ec03652b5e8" Size="67770" PackHash="f0e6dd8d8d08cc28a3855effd51f6af90c836827" PackOffset="695781" />
|
||||
<Blob Hash="b667cd5a5041e8a4c7696c29c04c14b4a1959bf7" Size="508928" PackHash="875d8d35845b297f89835123e1b9d8f6de2c93de" PackOffset="8" />
|
||||
<Blob Hash="b66807e7d4c75908143db1248feb01e2dfe177d7" Size="1586" PackHash="bf6ccb8b8cb10a5dfa1a4c6e7c988496d81ee69d" PackOffset="728689" />
|
||||
<Blob Hash="b66a480aee878eeee6dfe399e83bed6c32062966" Size="150223" PackHash="89206b79d1fdff630b49b7b3e25dbab0216f6d38" PackOffset="859817" />
|
||||
<Blob Hash="b66b4544fb0d47aa665e6557ecf6e51c951acfb9" Size="15240" PackHash="4d9858eebf791a46672e2bff0b35be0eba675a1d" PackOffset="813576" />
|
||||
@@ -124059,6 +124061,7 @@
|
||||
<Pack Hash="8714a3928212e24829166fc0a6ad2c2f2d17eb3f" Size="2096837" CompressedSize="756159" RemotePath="UnrealEngine-14689227" />
|
||||
<Pack Hash="872d7d4b063778a2b12865e018ce4ebe644ee1e4" Size="2096171" CompressedSize="1095490" RemotePath="UnrealEngine-15741284" />
|
||||
<Pack Hash="874bf3a7c51ae4160497b770f1dc3a443358d0a0" Size="1896192" CompressedSize="904269" RemotePath="UnrealEngine-7678422-c231b5fdee5b4c56b4db657bf8df4fc7" />
|
||||
<Pack Hash="875d8d35845b297f89835123e1b9d8f6de2c93de" Size="508936" CompressedSize="244115" RemotePath="UnrealEngine-16603787" />
|
||||
<Pack Hash="876aef235edb3e57ec8a6cc41c1f4e60a45f00f6" Size="1397436" CompressedSize="713725" RemotePath="UnrealEngine-9954827-b7c45323c9f34d9abe0bddc50d4c769c" />
|
||||
<Pack Hash="8772db1a2582bcc552a157d4de50d39366e84257" Size="79785696" CompressedSize="21101514" RemotePath="UnrealEngine-6550419-5b15c7c1f0a44c4f83c440737d93b283" />
|
||||
<Pack Hash="8786d7a51c4f60ae97c5d2b96fe8df15e678a764" Size="2097100" CompressedSize="568193" RemotePath="UnrealEngine-14445373" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
@@ -118,6 +119,9 @@ public partial class Project : CommandUtils
|
||||
|
||||
private static void RunInternal(ProjectParams Params, string ServerLogFile, string ClientLogFile)
|
||||
{
|
||||
// Start the UnrealTrace
|
||||
StartUnrealTrace();
|
||||
|
||||
// Setup server process if required.
|
||||
if (Params.DedicatedServer && !Params.SkipServer)
|
||||
{
|
||||
@@ -1048,4 +1052,35 @@ public partial class Project : CommandUtils
|
||||
PopDir();
|
||||
return Result;
|
||||
}
|
||||
|
||||
private static bool StartUnrealTrace()
|
||||
{
|
||||
// [TEMPORARY] - UnrealTrace server is currently only available on Windows
|
||||
if (!Utils.IsRunningOnWindows)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// [/TEMPORARY]
|
||||
|
||||
LogInformation("UnrealTrace: Starting server");
|
||||
|
||||
// Locate the UnrealTrace binary
|
||||
var UnrealTracePath = HostPlatform.Current.GetUE4ExePath("UnrealTrace.exe");
|
||||
if (!File.Exists(UnrealTracePath))
|
||||
{
|
||||
LogWarning("UnrealTrace: Unable to locate binary at " + UnrealTracePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Launch UnrealTrace and wait for it to fork and return
|
||||
Process Proc = Process.Start(UnrealTracePath);
|
||||
Proc.WaitForExit();
|
||||
if (Proc.ExitCode != 0)
|
||||
{
|
||||
LogWarning("UnrealTrace: Failed to start server; ExitCode=" + Proc.ExitCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,8 @@ public class UnrealInsightsTarget : TargetRules
|
||||
bBuildDeveloperTools = true;
|
||||
|
||||
bHasExports = false;
|
||||
|
||||
// Have UnrealInsights implicitly launch the trace store.
|
||||
GlobalDefinitions.Add("WITH_UNREAL_TRACE_LAUNCH=1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
#include "ProfilingDebugging/TraceAuxiliary.h"
|
||||
#include "Trace/Trace.h"
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
# include "Windows/AllowWindowsPlatformTypes.h"
|
||||
# include <Windows.h>
|
||||
# include "Windows/HideWindowsPlatformTypes.h"
|
||||
#endif
|
||||
|
||||
#if !defined(WITH_UNREAL_TRACE_LAUNCH)
|
||||
# define WITH_UNREAL_TRACE_LAUNCH (PLATFORM_DESKTOP && !UE_BUILD_SHIPPING && !IS_PROGRAM)
|
||||
#endif
|
||||
|
||||
#if UE_TRACE_ENABLED
|
||||
|
||||
#include "BuildSettings.h"
|
||||
@@ -29,12 +39,6 @@
|
||||
#include "Templates/UnrealTemplate.h"
|
||||
#include "Trace/Trace.inl"
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
#include "Windows/AllowWindowsPlatformTypes.h"
|
||||
#include <Windows.h>
|
||||
#include "Windows/HideWindowsPlatformTypes.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const TCHAR* GDefaultChannels = TEXT("cpu,gpu,frame,log,bookmark");
|
||||
const TCHAR* GMemoryChannels = TEXT("memtag,memalloc,callstack,module");
|
||||
@@ -480,6 +484,61 @@ static FAutoConsoleCommand TraceAuxiliaryResumeCmd(
|
||||
|
||||
|
||||
|
||||
#if WITH_UNREAL_TRACE_LAUNCH
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#if PLATFORM_WINDOWS
|
||||
static void StartUnrealTrace()
|
||||
{
|
||||
FString BinPath = "\"";
|
||||
BinPath += FPaths::EngineDir();
|
||||
BinPath += "/Binaries/Win64/UnrealTrace.exe\"";
|
||||
|
||||
uint32 Flags = 0x0100'0000; // CREATE_BREAKAWAY_FROM_JOB
|
||||
STARTUPINFOW StartupInfo = { sizeof(STARTUPINFOW) };
|
||||
PROCESS_INFORMATION ProcessInfo = {};
|
||||
BOOL bOk = CreateProcessW(nullptr, LPWSTR(*BinPath), nullptr, nullptr,
|
||||
false, Flags, nullptr, nullptr, &StartupInfo, &ProcessInfo);
|
||||
|
||||
if (!bOk)
|
||||
{
|
||||
UE_LOG(LogCore, Warning, TEXT("Unable to launch the trace store from '%s' (%08x)"), *BinPath, GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
if (WaitForSingleObject(ProcessInfo.hProcess, 5000) == WAIT_TIMEOUT)
|
||||
{
|
||||
UE_LOG(LogCore, Warning, TEXT("Timed out waiting for the trace store to start"));
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD ExitCode = 0x0000'a9e0;
|
||||
GetExitCodeProcess(ProcessInfo.hProcess, &ExitCode);
|
||||
if (ExitCode)
|
||||
{
|
||||
UE_LOG(LogCore, Warning, TEXT("Trace store returned an error (%08x)"), ExitCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogCore, Log, TEXT("Trace store launch successful"));
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle(ProcessInfo.hProcess);
|
||||
CloseHandle(ProcessInfo.hThread);
|
||||
}
|
||||
#endif // PLATFORM_WINDOWS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#if PLATFORM_UNIX || PLATFORM_MAC
|
||||
static void StartUnrealTrace()
|
||||
{
|
||||
/* nop */
|
||||
}
|
||||
#endif // PLATFORM_UNIX/MAC
|
||||
#endif // WITH_UNREAL_TRACE_LAUNCH
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
UE_TRACE_EVENT_BEGIN(Diagnostics, Session2, NoSync|Important)
|
||||
UE_TRACE_EVENT_FIELD(UE::Trace::AnsiString, Platform)
|
||||
@@ -495,6 +554,15 @@ UE_TRACE_EVENT_END()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void FTraceAuxiliary::Initialize(const TCHAR* CommandLine)
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE(FTraceAux_Init);
|
||||
|
||||
#if WITH_UNREAL_TRACE_LAUNCH
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE(FTraceAux_StartUnrealTrace);
|
||||
StartUnrealTrace();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UE_TRACE_ENABLED
|
||||
// Trace out information about this session. This is done before initialisation
|
||||
// so that it is always sent (all channels are enabled prior to initialisation)
|
||||
|
||||
Reference in New Issue
Block a user