// Copyright Epic Games, Inc. All Rights Reserved. using System; namespace EpicGames.UBA { /// /// Trace interface /// public interface ITrace : IBaseInterface { /// /// Begin task. Will create a bar in uba visualizer /// /// Description showing on bar in visualizer /// Details showing when hovering over bar in visualizer /// Task id public abstract uint TaskBegin(string description, string details); /// /// Add hint to task.. will show with milliseconds since start or previous hint /// /// Task id returned by TaskBegin /// Hint text public abstract void TaskHint(uint taskId, string hint); /// /// End task. /// /// Task id returned by TaskBegin public abstract void TaskEnd(uint taskId); /// /// Writes external status to the uba trace stream which can then be visualized by ubavisualizer /// /// Row of status text. Reuse one index to show one line in visualizer /// The identation of status name that will be shown in visualizer /// The status text that will be shown in visualizer /// The status type /// Optional hyperlink that can be used to make text clickable in visualizer public abstract void UpdateStatus(uint statusRow, uint statusColumn, string statusText, LogEntryType statusType, string? statusLink = null); /// /// Writes trace to file. Only works if created with ITrace.Create /// public abstract void CloseAndWrite(string traceFileName); /// /// Creates a new trace /// public static ITrace Create(string? name = null) { return new TraceImpl(name); } } /// /// Helper type to track task in scope /// public readonly struct TraceTaskScope : IDisposable { private readonly ITrace _trace; private readonly uint _taskId; /// /// Will create a bar in uba visualizer /// /// Trace used for this task scope /// Description showing on bar in visualizer /// Details showing when hovering over bar in visualizer public TraceTaskScope(ITrace trace, string description, string details) { _trace = trace; _taskId = trace.TaskBegin(description, details); } /// /// End task /// public void Dispose() { _trace.TaskEnd(_taskId); } } }