Api Sandbox Diagnostics FastTimer
struct

FastTimer

public sealed struct FastTimer

A lightweight, high-resolution timer for performance measurement. More efficient than Stopwatch with a simpler API.

Properties

Name Type Description
StartTick Int64 Gets the timestamp when the timer was started.
ElapsedTicks Int64 Gets the number of ticks elapsed since the timer was started.
ElapsedMicroSeconds Double Gets the number of microseconds elapsed since the timer was started.
ElapsedMilliSeconds Double Gets the number of milliseconds elapsed since the timer was started.
ElapsedSeconds Double Gets the number of seconds elapsed since the timer was started.
Elapsed TimeSpan Gets the time elapsed since the timer was started as a TimeSpan.

Methods

static FastTimer StartNew()

Creates and starts a new FastTimer.

returns — A started FastTimer
Void Start()

Starts or restarts the timer.

Examples

var timer = FastTimer.StartNew();
// Do work...
Log.Info( $"Took {timer.ElapsedMilliSeconds}ms" );
Assembly: Sandbox.System Namespace: Sandbox.Diagnostics Full Name: Sandbox.Diagnostics.FastTimer