Commit Graph

423 Commits

Author SHA1 Message Date
Rob Gay
5453650939 Checkpoint: Pipe source data to dashboard UI listview (Part 1)
- Add trace provider, module, & analyzer and start piping data through it as proof-of-concept
#rb max.hayes
#jira UE-169605
#rnx
#preflight 63753d471d25fe8b933fa452

[CL 23160520 by Rob Gay in ue5-main branch]
2022-11-16 15:13:38 -05:00
ionut matasaru
15126612ef [Insights] Fixed unsafe type cast warnings in TraceAnalysis module.
#rb Martin.Ridgers
#preflight 633583adf418a1071a57fc98

[CL 22271566 by ionut matasaru in ue5-main branch]
2022-09-30 11:28:14 -04:00
ionut matasaru
256e1b2a5f [Insights] Fixed serialization to Cbor for EventData with zero fields.
#rb none
#preflight 63341fd4dc213d2eadfd572c

[CL 22232212 by ionut matasaru in ue5-main branch]
2022-09-28 17:55:57 -04:00
Martin Ridgers
43d162234f Allow a small amount of tracing when allocating memory for trace buffers
Previously any events traced while Trace allocates memory to trace events into were dropped because there was nowhere to write these events. This change
splits memory allocation into two functions, one that will capture and send events when safe to do so, and one that doesn't capture events at all. For that latter, the capture is moved out to where allocating trace buffers happens so that captured events can be added to the buffer just allocated. This ensure order is maintained and that serials are ascending on a thread.

Partial buffers; prior to this change, aux-data that was larger than available space in a buffer would be fragmented across multiple buffers. Buffers that started in the middle of aux-data were marked partial as there was no way for analysis to interpret the stream from this point. As it is now possible that allocation-traced events will be written into the buffer before it's made available, each fragment is preceded with a aux-data header. This makes the stream recoverable from any buffer and negates the need for having partial buffers at all. As aux-data can now be constructed of two or more aux-data events for a single field of an event, analysis needs to be aware of this and defragment these events.

Late connect; analysis of a stream can now start with aux-data/terminal events with no corresponding owning event. This is fine; they get skipped over in DispatchEvents().

It is a deliberate choice to have a limited amount of redirected-buffer space to capture allocation-traced events. There needs to be enough space remaining in the new buffer to trace the outer event. Some platforms also have a limited amount of stack per thread.

The Writer_AddPageToPool() in Writer_InitializePool() didn't do anything and was removed.

GInitialized was set to early and subvert the reliance on static initialisation guarantees

#rnx
#jira UE-157559
#jira UE-161280
#preflight 632057f3bc40358fa290f403

[CL 21980603 by Martin Ridgers in ue5-main branch]
2022-09-13 06:42:08 -04:00
bryan sefcik
de1956f47b Ran IWYU on Public headers under Engine/Source/Developer/...
Headers are updated to contain any missing #includes needed to compile and #includes are sorted.  Nothing is removed.

#ushell-cherrypick of 21064294 by bryan.sefcik
#jira
#preflight 62d5c2111062f2e63015e598

#ROBOMERGE-OWNER: bryan.sefcik
#ROBOMERGE-AUTHOR: bryan.sefcik
#ROBOMERGE-SOURCE: CL 21155249 via CL 21158121 via CL 21161259
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21182053 by bryan sefcik in ue5-main branch]
2022-07-20 12:03:45 -04:00
ionut matasaru
3c0bfe20cb [Insights] Fixed analysis to continue reading at least one more loop after encountering a SYNC point.
#rb Martin.Ridgers
#preflight 62d51886f156340c79abe4ce
#robomerge FNMain

[CL 21144142 by ionut matasaru in ue5-main branch]
2022-07-18 05:15:45 -04:00
Martin Ridgers
89b0459404 Fix serial gaps issue when no gaps are filled, but new appear, during the second sync phase.
#ushell-cherrypick of 20644780 by Johan.Berg
#rb martin.ridgers
#rnx
#preflight 62c8260af671e8d2faccafd7

[CL 21005759 by Martin Ridgers in ue5-main branch]
2022-07-08 08:49:13 -04:00
Johan Berg
570f495f32 [Insights] Change cbor return type to UTF8StringView
Unreal Trace Server now writes full UTF8 strings to the CBOR objects, change the corresponding string views to `FUtf8StringView` to support correct conversion to TCHAR based strings.

#rb ionut.matasaru
#jira UE-155288
#robomerge EngineMerge
#preflight 62bedf2eb024a2608c81d044

[CL 20913058 by Johan Berg in ue5-main branch]
2022-07-01 07:53:53 -04:00
Francis Hurteau
d6e85a7b90 Trace: Create interfaces in TraceServices for external Analysis
### Features
This change sets up new interface APIs and moves concrete APIs into those interfaces to allow for providers to be implemented external to TraceServices. These Provider interfaces are given to new construction APIs in ExternalAnalysis.h that construct the appropriate Analyzer with the specified Providers.

This change creates a new and standalone Analyzer for Bookmarks spinning logic directly out of the MiscAnalyzer. This is necessary to prevent bookmark processing necessitating additional Providers that the client may not want to implement if they just want access to Bookmark data.

SummarizeTraceCommandlet implements these provider interfaces and migrates it's state tracking implementation from raw event decoding to simply forwarding on the calls from the Provider interfaces. The internal SummarizeTraceCommandlet Analyzer API in the Commandlet are mostly left unchanged as a middleman between Trace and the Commandlet existed prior to this change.

### Implementation
Since Providers can now implement multiple interfaces, we need to upcast them to the appropriate interface at registration time. This in turn requires moving the Provider memory model into IAnalysisSession to TSharedPtr/MakeShared to prevent double deletes at destruction time.

### Performance
Opening a large trace in Insights yields this performance change:
Pre: Analyzed in 8.29s at 122.8X speed.
Post: Analyzed in 8.36s at 121.8X speed.
Commandlet runtime is comparable (I didn't measure, less sensitive than Insights), and memory pressure remains more or less steady in the low teens of gigabytes.

### Testing
A/B testing and spot checking the data shows that nearly all data is either more correct or withing many-decimal-places rounding error.
UnrealInsights and Editor builds without error in NoPCH, DisableUnity configurations

### Hashtags
#rb ionut.matasaru
#jira UE-120810
#preflight 62bc9d717f31fc8c31fd6d18
#robomerge EngineMerge

[CL 20893535 by Francis Hurteau in ue5-main branch]
2022-06-30 09:17:47 -04:00
Johan Berg
ca32e4c627 Metadata scopes
Adds runtime events and analysis for generic meta data scopes. Any scope emitted on the "Metadata" writer will be analyzed and accessible in the metadata provider. Currently one built-in metadata type is provided: "Asset", which mimics LLMs implementation of asset tracking.

#rb ionut.matasaru
#robomerge EngineMerge
#preflight 62b1b35d827ccccb2cd7da0d

[CL 20755918 by Johan Berg in ue5-main branch]
2022-06-21 08:20:57 -04:00
Johan Berg
fa13b92ab0 Changes to how definition provider works
#rb ionut.matasaru
#robomerge EngineMerge
#preflight 62a9ef0b634e82e5d1e8eddf

[CL 20670393 by Johan Berg in ue5-main branch]
2022-06-15 11:17:41 -04:00
Johan Berg
8050d3114a Expose raw event data in handler.
#preflight 6290ce8a1f0041249bee008d

[CL 20392383 by Johan Berg in ue5-main branch]
2022-05-27 09:29:46 -04:00
Johan Berg
af08ac6622 [TraceLog] Add signed/unsigned integer distinction
#rb martin.ridgers
#preflight 62874171df5ff06fef540af5

[CL 20291967 by Johan Berg in ue5-main branch]
2022-05-20 03:37:02 -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
Johan Berg
5d363d7245 [TraceLog] Add definition event types and reference fields.
Adds a new field type for trace events which contains a reference to a previously emitted event. In order to create a reference, the referenced event type needs to be declared with a new "definition" flag. The definition flag also defines type of id that is used for the reference, 8, 16, 32 and 64 bit values are supported.

#rb ionut.matasaru, martin.ridgers
#preflight 627393ea4e24dbee173d42c5

[CL 20055730 by Johan Berg in ue5-main branch]
2022-05-05 05:30:07 -04:00
Johan Berg
7a928530a2 Fix CIS errors on Mac
#rb none
#preflight 624c4d54683a7dd323b02e7d

[CL 19625055 by Johan Berg in ue5-main branch]
2022-04-05 10:37:43 -04:00
Martin Ridgers
6121cb7442 Fixed mismatched malloc/delete[] pairing.
#rb trivial
#rnx
#jira UE-144608
#preflight 6220d8df6a33f9b416a8cf4f

[CL 19244232 by Martin Ridgers in ue5-main branch]
2022-03-03 10:39:53 -05:00
Catalin Dragoiu
04455f4b88 Fix Mac compile error.
#rb trivial
#preflight 6218b02b8849a7424f7f7740

[CL 19143970 by Catalin Dragoiu in ue5-main branch]
2022-02-25 05:35:44 -05:00
Catalin Dragoiu
828042a563 [Insights] Fix trace list not refreshing MAC
#jira UE-137793
#preflight 62178f9f1a114ad504399e8d
#rb Ionut.Matasaru Johan Berg

[CL 19143744 by Catalin Dragoiu in ue5-main branch]
2022-02-25 04:53:37 -05:00
Catalin Dragoiu
2e1ff374d1 [Insights] Fix trace list not refresing when adding or deleting trace files on Linux.
#jira UE-137793
#rb Ionut.Matasaru Johan.Berg
#preflight 6214ba2f9e2201e21403e22c

[CL 19070550 by Catalin Dragoiu in ue5-main branch]
2022-02-22 05:54:56 -05:00
Martin Ridgers
c3874dabf2 Backed out 18978509
#rb jb
#rnx
#preflight 620d159a6202a22eedecf839

[CL 19014593 by Martin Ridgers in ue5-main branch]
2022-02-16 10:23:17 -05:00
Martin Ridgers
77907355f6 Reset active rota item count returning to do another pass over it.
Some rota items cannot make progress because their next event type is not known yet. They get moved to the end of the rota and the active count is decremented. There are two cases where the rota might be reprocessed from the beginning again; when an initial serial is set, and when the rota shows it has the next event. It is possible that on a subsequent pass through the rota, items that could not make progress previously might be able to this time. However, because the active count was left over from before they were excluded and OnData() would not do all the work it could possibly do.

All this only applies to old P2 traces.

#rb jb
#rnx
#preflight 620cd9a36202a22eeddb71ff

[CL 19014434 by Martin Ridgers in ue5-main branch]
2022-02-16 10:14:39 -05:00
Martin Ridgers
0e00b638ae Call OnData() one last time after reaching the end of the input trace stream.
Newer protocol traces consume as much data as they can before returning from OnData(). Older protocol support however can return will data still to process that will be continued on the next OnData() call. However, if the end of input stream has already been met the subsequent OnData() call is not made. The bug's always been present but hidden by a small input buffer.

#rb jb
#rnx
#preflight 620a5b00803d9066e67bf24d

[CL 18978509 by Martin Ridgers in ue5-main branch]
2022-02-14 08:55:31 -05:00
Martin Ridgers
4654c71f03 Restored early out once all analyzers have indicated they're no longer interested in further events.
#rb jb
#rnx
#preflight 620622d6b832ea70d8816819

[CL 18949967 by Martin Ridgers in ue5-main branch]
2022-02-11 04:03:07 -05:00