Version: 2021.3
public static long Timestamp ;

描述

Gets Profiler timestamp.

Use to measure time intervals with the same accuracy as Unity Profiler.

using Unity.Profiling.LowLevel.Unsafe;

public class Example { public static long ElapsedNanoseconds(long startTimestamp) { long now = ProfilerUnsafeUtility.Timestamp; var conversionRatio = ProfilerUnsafeUtility.TimestampToNanosecondsConversionRatio; return (now - startTimestamp) * conversionRatio.Numerator / conversionRatio.Denominator; } }