Class
Profile
View sourceRepresents the timing value for one labeled measurement.
Profiler#start records when the measurement starts, and
Profiler#end records the duration when it ends. Use
Profiler to create and access profiles, and use the static
serialization methods to preserve their values.
Constructor
Properties
lastTick: number
View sourceTimestamp captured by the most recent Profiler#start, in
milliseconds.
Default: 0
delta: number
View sourceDuration measured by the most recent Profiler#end, in
milliseconds. It remains unchanged until a matching label is ended.
Default: 0
Methods
staticserialize(value: Profile): ProfileSerial
View sourceConverts a profile to its serializable plain-object representation.
The returned object contains only the current lastTick and delta
numbers. It is a new object, so changing it does not mutate value.
staticdeserialize(value: ProfileSerial, out?: Profile): Profile
View sourceLoads serialized values into a profile.
The supplied out instance is reused when provided; otherwise a new
Profile is created. The method copies lastTick and delta
directly and does not validate the input, so call
Profile.validateSerial first when input is
untrusted.
staticvalidateSerial(value: unknown): value is ProfileSerial
View sourceChecks whether a value has the shape required by
Profile.deserialize.
The check requires a non-null object with numeric lastTick and delta
properties. It accepts additional properties and does not impose ranges
or reject NaN and infinities, because JavaScript classifies those values
as numbers.
