232 Commits

Author SHA1 Message Date
ionut matasaru
a8078ce4c2 [Insights] Updated limits for detecting too much data accumulated by trace analysis (number of parsed events).
#rb Johan.Berg

[CL 30770758 by ionut matasaru in ue5-main branch]
2024-01-22 09:24:24 -05:00
steve robb
f029468598 Fixed up a lot of bool-taking container resize functions to take EAllowShrinking instead.
[CL 30729174 by steve robb in ue5-main branch]
2024-01-19 16:41:35 -05:00
ionut matasaru
231006c9b4 [Insights]
- TraceAnalysis: Added debug functionality for trace transport and trace protocol analysis. See TraceAnalysisDebug.h for the available debug options (UE_TRACE_ANALYSIS_DEBUG_API, UE_TRACE_ANALYSIS_DEBUG, UE_TRACE_ANALYSIS_DEBUG_LOG, UE_TRACE_ANALYSIS_DEBUG_LOG_IMPL, UE_TRACE_ANALYSIS_DEBUG_LEVEL).
  - TraceAnalysis: Changed the limit for accumulated too much data on a single thread from 512 MiB to 2000 MB. Also implemented better code to skip serials when limit is encountered.
  - TraceAnalysis: Implemented workaround for corrupted traces (events with aux blocks missing the "aux terminal").
  - TraceAnalysis: Fixed EventData.GetArray<>() (to be safe to be called multiple times).

#rb Johan.Berg, Catalin.Dragoiu
[FYI] Martin.Ridgers

[CL 29268256 by ionut matasaru in ue5-main branch]
2023-10-31 04:07:11 -04:00
ionut matasaru
119dbc1a08 Enabled UnsafeTypeCast warnings as errors in Trace/Insights related modules (UnrealInsights, TraceAnalysis, TraceServices, TraceDataFiltering, TraceUtilities, EditorTraceUtilities).
Fixed conversion warnings in TraceAnalysis and in TraceServices modules.

#rb Catalin.Dragoiu

[CL 28339045 by ionut matasaru in ue5-main branch]
2023-09-29 07:22:52 -04:00
ionut matasaru
0f0d444fd3 [Insights] Warkaround for corrupted traces with missing sync events. Analysis will not stop anymore when buffering more than 512 MiB of trace data. Instead, it will emit an error and then it will start to skip the missing serial numbers.
#rb Catalin.Dragoiu
[FYI] Johan.Berg

[CL 26700510 by ionut matasaru in ue5-main branch]
2023-07-31 04:33:40 -04:00
Johan Berg
377aa7c246 Remove usage of MessageLog in analysis.
Usage of MessageLog in non-ui threads is tricky and need to be carefully managed to avoid flushing memory on the wrong thread. With this change direct usage of MessageLog in the analysis engine is removed and replaced with a callback system which allows the user of TraceAnalysis to implement display of the messages themselves. In the case of InsightsManager this means queuing up the messages in analysis session and regularly polled from the UI thread.

#rb ionut.matasaru
#jira UE-185528

[CL 26086861 by Johan Berg in ue5-main branch]
2023-06-19 07:17:37 -04:00
bryan sefcik
5b6c78e627 Removed monolothic header includes.
#preflight 647a50f58417d79259bf0677
#jira

[CL 25775811 by bryan sefcik in ue5-main branch]
2023-06-02 18:21:36 -04:00
Johan Berg
d7edd5ebfa Add user facing error message if transport layer error is detected.
#rb martin.ridgers, ionut.matasaru
#jira UE-174948
#preflight 63e4c581e86828e8c87bd2e2

[CL 24094435 by Johan Berg in ue5-main branch]
2023-02-09 05:19:47 -05:00
ionut matasaru
4cdebba7f3 [Insights] Fixed time for scoped events to be relative to base timestamp at runtime. This allows packing on 8 bytes (as in trace protocol 5). Added EnterScope_TB / LeaveScope_TB (timestamps relative to BaseTimestamp) events in addition to EnterScope_TA / LeaveScope_TA (absolute timestamps).
#jira UE-175374
#jira UE-175081
#rb Catalin.Dragoiu
#rb Johan.Berg
#preflight 63d7b1ad1f0aa8a28940eb30
#lockdown mark.lintott

[CL 23931997 by ionut matasaru in ue5-main branch]
2023-01-31 13:23:28 -05:00
ionut matasaru
c5facd5918 [Insights] Fixed trace analysis for scoped trace events (adjusts time to be relative to the base timestamp).
#jira UE-175081
#rb trivial
#preflight skip

[CL 23855673 by ionut matasaru in ue5-main branch]
2023-01-25 15:58:23 -05:00
ionut matasaru
39be21b62f [Insights] Added analysis support for the new trace protocol 7 (scoped events with absolute timestamp values).
#jira FORT-534052
#rb Johan.Berg
#preflight 63d0efc3d83c1837b1f21392

[CL 23845359 by ionut matasaru in ue5-main branch]
2023-01-25 04:26:15 -05:00
Martin Ridgers
1fb8d0b70e More robust analysis of trace streams where a large distance occurs between consecutive serialised events on different threads.
The main premise of this change is to order the heap of pending serialised events by distance from the next expected serial instead of in respect to each other. By using an unsigned comparison, wrapped serials that would otherwise appear on the negative side of the expected serial, in fact sort to the positive side. This allows the use of the full serial space as wraps no longer need to be calculated when sorting.
#rb jb
#rnx
#preflight 63caa0e6894b6403149bf5c0

[CL 23789248 by Martin Ridgers in ue5-main branch]
2023-01-20 09:17:33 -05:00
Johan Berg
84495298d7 [Insights] Surface error messages from analysis engine to the user
We have previously relied on UE_LOG messages to indicate problems in analysis. This change converts those log messages to use MessageLog functionality which is routed to a visual log representation inside the application (but also the log file).

Additionally adds functionality to show the Insights log windows when ever (new) errors are encountered.

#rb ionut.matasaru
#jira UE-154022
#preflight 63c91aa80225f00e14758d19

[CL 23771338 by Johan Berg in ue5-main branch]
2023-01-19 05:33:25 -05:00
ionut matasaru
bc786b8355 [Insights]
- Added workaround for large utrace streams with corrupted serial sync events (detects when too much data is buffered on one thread and stops analysis automatically).
  - Changed the read buffers to increase their size in power of two steps.

#rb Martin.Ridgers
#preflight 639996388c5081ee9a857e57

[CL 23510588 by ionut matasaru in ue5-main branch]
2022-12-14 06:13:07 -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
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
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
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
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
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
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
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
Martin Ridgers
6bee1a2eb6 Be explicit about the character size we're expecting.
If TCHAR happens to change to something other than a 16bit integer (e.g. because wchar_t is four bytes on a platform, or because the engine changes to UTF8), the analysis engine will no longer be able to read traces with char16_t-type strings.

#rb jb
#rnx
#preflight 61fd3091ed26b9fd9c7fcc0e

[CL 18862539 by Martin Ridgers in ue5-main branch]
2022-02-04 09:16:04 -05:00