Commit Graph

405 Commits

Author SHA1 Message Date
Johan Berg
8a92cd22e4 Fix on-connection strings having different type ids.
Since there were two different events for declaring strings and FNames, one regular and one no-sync version used in on-connection callback, references would not be correctly resolved. We remove the no sync version and use only one version. In order to solve the synchronizing we defer resolving the strings in analysis.
#preflight 62a9c8932a1103ff5fb784ae
#robomerge EngineMerge

[CL 20668219 by Johan Berg in ue5-main branch]
2022-06-15 08:03:24 -04:00
Marc Audy
0d230333ce Fix non unity errors and #pragma once in cpp warnings
#jira UE-156342
#rnx
#preflight

[CL 20606904 by Marc Audy in ue5-main branch]
2022-06-11 02:02:22 -04:00
Johan Berg
c8a8270308 String tracing
Adds a tracing subsystem to trace deduplicated strings and FNames.

#rb ionut.matasaru, johan.torp
#preflight 62a2f06b54169bd8aa25a97b

[CL 20591319 by Johan Berg in ue5-main branch]
2022-06-10 03:38:35 -04:00
ionut matasaru
dcef95fb8b Fixed callstack tracing not capturing correct backtrace for majority of allocations in Editor Win64 Debug.
The cause of the bug is the fact that few allocations are made before loaded modules are registered. For those initial allocs, the stack cannot be properly backtraced and the code caches that info for its function on top of the stack (which is "MemoryTrace_Alloc" in debug config and "CallstackTrace_InitializeInternal" for development config). Further callstacks that encounters those functions stops backtracing, so the result is a "one frame callstack". Debug build is seriously affected by this bug because "MemoryTrace_Alloc" is present in the callstack of majority of allocations (so all of them will be reduced to one frame).

#jira UE-155667
#rb Johan.Berg
#preflight 629ea3ad732d8e28403311d3

[CL 20535244 by ionut matasaru in ue5-main branch]
2022-06-07 06:36:43 -04:00
Johan Berg
281488e2aa [TraceLog] Add OnConnection callback
Adds a callback which is issued from Trace whenever a new connection is established. Any event emitted inside the callback are collected separately and written to the trace stream after important events, but before events collected in the tail buffer. In the engine layer the callback is exposed as static delegate on TraceAuxiliary.

#rb martin.ridgers, ionut.matasaru
#preflight 6298bbad63529f84faeab10b

[CL 20468957 by Johan Berg in ue5-main branch]
2022-06-02 10:01:45 -04:00
Marc Audy
c77dc2604e Fix non-unity
#rnx
#preflight

[CL 20403276 by Marc Audy in ue5-main branch]
2022-05-28 01:16:10 -04:00
geoff evans
a01f28498a Trace: Enable Default Trace Channels automatically for Editor
### Features
Prior to this change there are no trace channels active for any Editor process, and default channels were accessed by passing -trace or -trace=default.

This change enables default channels automatically for Editor.

#rb ionut.matasaru
#jira UE-151707
#preflight 627d6b4ba82f3adab8b0de98

#ROBOMERGE-AUTHOR: geoff.evans
#ROBOMERGE-SOURCE: CL 20394530 via CL 20394607 via CL 20394639
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246)

[CL 20398664 by geoff evans in ue5-main branch]
2022-05-27 16:49:15 -04:00
Johan Berg
a86afcb0fd Memory tracing refactorings
As the memory tracing implementation grew and callstack tracing was extracted it became clear that alot of the code which was implemented as platform specific should really be platform independent. This changelist moves all MemoryTrace_* methods except the MemoryTrace_Initialize to a platform independent layer. This also allows for internalizing the "do-not-allocate-while-tracing-an-allocation" flag. Also took the oportunity to rename MemoryTrace.cpp in Microsoft folder to better reflect platform specific file.

#rb ionut.matasaru
#preflight 6290df2d3c05bea8bfd3ed82
#preflight 6290eb90b83292836e074fff

[CL 20394897 by Johan Berg in ue5-main branch]
2022-05-27 12:39:27 -04:00
ionut matasaru
df6018342f Added CacheAllocated statistics for trace system (all memory allocated in cache buffers).
Fixed "Important Events cache" stats displayed by Trace.Status console command.

#rb Johan.Berg
#preflight 628f37cdc511f67c9f0905f6

[CL 20376989 by ionut matasaru in ue5-main branch]
2022-05-26 04:47:52 -04:00
Catalin Dragoiu
fa1e5b2bc7 Trace screenshots from the Shot and HighResShot commands when the Screenshot channel is on.
#rb Ionut.Matasaru
#preflight 628c9cdd6f6741ae31578ea9

[CL 20346623 by Catalin Dragoiu in ue5-main branch]
2022-05-24 08:13:55 -04:00
Catalin Dragoiu
0b478d5694 Cooking Profiler Prototype
#rb Ionut.Matasaru  Matt Peters
#preflight 628b8690693c5e1de2773a39

[CL 20327158 by Catalin Dragoiu in ue5-main branch]
2022-05-23 10:13:54 -04:00
ionut matasaru
f24c462eeb [Insights] Added more LLM_SCOPEs ("Trace/CpuProfiler" and "Trace/Stats").
#rb Johan.Berg
#preflight 62876a371e478b95c7fc6d08

[CL 20292637 by ionut matasaru in ue5-main branch]
2022-05-20 07:12:25 -04:00
ionut matasaru
f319b6cd6e Fixed CIS error (-NoPCH -DisableUnity).
#rb trivial
#jira UE-152669
#preflight skip

[CL 20246426 by ionut matasaru in ue5-main branch]
2022-05-17 13:24:57 -04:00
ionut matasaru
1c905ca529 [Insights] Added "TraceAnalysis" and "Trace/CpuProfile" LLM_SCOPEs (in an effort to reduce the Untagged allocations):
- "TraceAnalysis" -- captures all mem allocated by the FAnalysisProcessor.
  - "Trace/CpuProfile" -- captures allocation of per-thread buffers used by the cpu profiler trace.

#jira UE-147172 (partially)
#rb Johan.Berg
#preflight 6281fc9fd819c085e0ad0fe5

[CL 20222034 by ionut matasaru in ue5-main branch]
2022-05-16 07:37:42 -04:00
evgenii babinets
1bf9d7bb91 Unifying how we modify GCycleStatsShouldEmitNamedEvents so that we guarantee it won't drop below zero (should never happen, but just in case so that we can change checks to be != 0).
#rb jordan.cristiano

#ROBOMERGE-AUTHOR: evgenii.babinets
#ROBOMERGE-SOURCE: CL 20190641 via CL 20190656 via CL 20190671
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20192726 by evgenii babinets in ue5-main branch]
2022-05-13 20:46:55 -04:00
geoff evans
0988a55b0a Trace Snapshot to File
### Features
We can now write tailing memory to a utrace file. Snapshotting while tracing to a file or socket is supported.
This change introduces a new console command: Trace.SnapshotFile. It writes the profiling data from memory into an optionally specified a utrace file.

### Testing
Run Editor with -tracefile
Run Editor with -trace, connect live with insights
Run Editor without -trace (this does generate a very small utrace since there is memory and data in the tail even though default channels are not enabled)

#rb johan.berg
#jira UE-150302,UE-150292
#preflight 6272a3213e1f2a9d3a88ee3d

#ROBOMERGE-OWNER: geoff.evans
#ROBOMERGE-AUTHOR: geoff.evans
#ROBOMERGE-SOURCE: CL 20124258 via CL 20125717 via CL 20126082
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20129506 by geoff evans in ue5-main branch]
2022-05-10 17:03:04 -04:00
michael sartain
56a899a84d Move FCsvProfiler BeginFrame / EndFrame to single location in UEngine::TickPerformanceMonitoring() function
This should fix the case where performance counters are set but none of them do Begin / End CSV calls or potentially do multiple calls.

Also add logging to FCsvProfiler::EndFrame() so we can tell when ECsvCommandType::Stop is processed.

#rnx
#rb Ilya.Loshchinin
[FYI] Ben.Woodhouse, Bart.Hawthorne, Andrew.Ladenberger
#preflight 626eb998c731e279c32db6ba

#ROBOMERGE-AUTHOR: michael.sartain
#ROBOMERGE-SOURCE: CL 20041664 via CL 20042062 via CL 20042078 via CL 20042092 via CL 20042112
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20043206 by michael sartain in ue5-main branch]
2022-05-04 12:17:27 -04:00
geoff evans
1981b2f5f3 StallDetector support for Linux
### Features

This change enables the StallDetector watchdog in Editor to submit reports to crashreporter about threads violating instrumented deadlines in the source code. This feature was available prior on Windows, and this change adds Linux support.

### Notes

New APIs:
ReportStall()
CaptureThreadPortableCallStack()

Many APIs are updated from purely "Ensure" naming to more general naming. Stalls are more like Ensures than crashes, and so the appropriate renames to make the code readable and clear have been made. In some places Ensure is replaced with the clearer: Continuable Event nomenclature.

### Testing

I synthesized an ensure on Linux, and did the same for a stall. I then compared crash report XML file to make sure they contain accurate data in the callstack, portable callstack, and other fields in the report. I also noted that the stall information was showing as expected in the crash reporter.

#rb brandon.schaefer, francis.hurteau
#jira UETOOL-3336
#preflight 625e20d2804460ab0fea3277

[CL 19911608 by geoff evans in ue5-main branch]
2022-04-25 19:19:04 -04:00
Johan Berg
1cbc991e0e Fix issue with externally connected trace connections and status message.
#rb none
#jira UE-148943
#preflight 6262b517bc24759dc736f313

[CL 19864696 by Johan Berg in ue5-main branch]
2022-04-22 10:06:31 -04:00
john huelin
7332066e27 Fix 2 Insights callstack tracing crashes when capturing on some platforms.
First one because due to RTC in EOS not having frame pointers causing a crash when walking down the stack. Limiting callstack tracing with a scope.

The second one because of limited stack size (4k) in a Curl Helper thread, causing a crash when walking down the stack because the callstack walker was allocating 4k on the stack. Doing it inplace to allocate only 2k.

[REVIEW] [at]johan.berg
[FYI] pavel.punsky
#rnx

#ROBOMERGE-OWNER: john.huelin
#ROBOMERGE-AUTHOR: john.huelin
#ROBOMERGE-SOURCE: CL 19739450 via CL 19739526 via CL 19739543 via CL 19739742 via CL 19739765
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v938-19570697)

[CL 19741582 by john huelin in ue5-main branch]
2022-04-13 12:50:15 -04:00
Sebastian Thomeczek
53ad72b2e5 FTraceAuxiliary: Added GetTraceDestination, IsConnected and GetActiveChannelsString to public interface.
#rb Johan.Berg
#preflight none

[CL 19667767 by Sebastian Thomeczek in ue5-main branch]
2022-04-07 09:18:58 -04:00
Johan Berg
3962277bdd Add a way to express fallback tag in Memory Trace
Manual memory tracking in LLM has a feature for defining a "fallback tag" for the allocation if no tag is currently set. This change adds a new scope type which allows us to express this behaviour in memory tracing as well.

#jira UE-142692
#rb ionut.matasaru
#preflight 624ed4e9bd5b36eec338a937

[CL 19667413 by Johan Berg in ue5-main branch]
2022-04-07 08:48:22 -04:00
Arne Schober
e2a4b02ddf M - Support for Unreal Insights to allow Suspend/Resume of Scope stacks which is Used by Coroutines.
#preflight 624c70b27d2eea4e18e0ad62

[CL 19639870 by Arne Schober in ue5-main branch]
2022-04-05 22:30:11 -04:00
Andriy Tylychko
3b82927aee removed unused NewTasks from TaskGraph's FGraphEvent::DispatchSubsequents() calls, as a preparation for deprecation
#preflight https://horde.devtools.epicgames.com/job/6244160fdc6183e3f5ef6650
#rb francis.hurteau, danny.couture

[CL 19554617 by Andriy Tylychko in ue5-main branch]
2022-03-30 04:53:52 -04:00
Catalin Dragoiu
e0475b1694 Screenshot tracing initial implementation
#rb Ionut.Matasaru Johan.Berg
#preflight 6239f65abc1cf2803864a90c

[CL 19467957 by Catalin Dragoiu in ue5-main branch]
2022-03-22 12:35:42 -04:00