NucCycleReport
public sealed record NucCycleReport : IEquatable<NucCycleReport>
What one SDK-commanded shutter cycle asked for, what it got, and what it did.
Delivered to the handler given to ThermalCamera.OnNucCycle(…), once per cycle that reached a decision, at the moment the decision is taken. ThermalCamera.LastNucCycle returns the most recent one, for a handler installed after a cycle had already happened.
Every number here was already computed, once per cycle, and went only to the SDK's log. A fifteen-camera host reported the symptom this is for: 24 cycles on one camera that all logged "Finalizing with 8 frames" and were indistinguishable from 24 good ones, while the tile showed a near-uniform field: a dark reference averaged from frames of the scene. The quantity that separates a slow camera from a host losing frames was unreachable, because every rate the SDK publishes is measured where frames arrive, so the two are identical on a clock.
A cycle taken over by a process interface, or cut short by a mode switch, a reconnect or shutdown, never reaches a decision and reports nothing. NucCycleReport.Sequence is how a consumer sees that: it counts cycles reported, so it does not advance.
Example
camera.OnNucCycle(cycle => { if (cycle.Outcome != NucCycleOutcome.DiscardedTooFewFrames) { return; } // Which of the two it is decides what to do about it, and the // share is the only thing that can say. string cause = cycle.DeliveryShare switch { null => "the camera carries no frame counter, so this host " + "cannot be measured", < 0.9f => $"the host received {cycle.DeliveryShare:P0} of " + "this camera's frames", _ => "the host received the camera's frames; the closure " + "itself was short", }; log.WriteLine($"NUC discarded: {cycle.FramesKept} of " + $"{cycle.FramesFloor} needed: {cause}"); });
NucCycleReport: constructors
public NucCycleReport(NucCycleOutcome Outcome, uint RequestedCameraFrames, TimeSpan PlannedFramePeriod, Nullable<float> DeliveryShare, uint ExpectedReceivedFrames, uint CameraCounterSpan, uint FramesKept, uint FramesDiscarded, uint FramesRejectedNotShut, uint FramesTarget, uint FramesFloor, TimeSpan Capture, bool EndedAtReopen, TimeSpan Timestamp, DateTimeOffset HostTime, ulong Sequence)
What one SDK-commanded shutter cycle asked for, what it got, and what it did.
Outcome: What the cycle did to the dark reference.RequestedCameraFrames: The closure the SDK asked the camera for, in the camera's own frames. The hardware is handed a count of its own frames and reopens by itself after that many; the SDK never commands the reopen. So this is not comparable with the received-frame counts, and the two being different units is the defect this pair was separated to prevent. The conversion between them isNucCycleReport.DeliveryShare.PlannedFramePeriod: The frame period the closure was planned at, measured where frames arrive. Carried because it is the input the plan was wrong about: on a host losing frames it is longer than the camera's, and a closure computed from it alone came out shorter than a healthy one: 25 frames at 32 Hz, 24 at 21, 21 at 10.DeliveryShare: Arrivals per frame the camera took, over the frames before this cycle, ornullwhen the camera could not be measured at all. Null is the answer "nobody could measure it", and it is not the same as 1. A camera whose stream format carries no frame counter cannot be measured, and the SDK itself reads such a camera as a share of 1: the value it assumed unconditionally before any of this existed, so an unmeasurable camera keeps exactly its old closure. The two cases mean opposite things about whether a short cycle is the host's fault, which is why this is a nullable rather than a 0 a reader would have to know about. 1 means "measured, and every frame arrived". Counted where the transport hands the frame over, ahead of the subsampling and export gates, because those drop frames deliberately: measured after them a camera subsampled to 8 Hz would report 0.125 and be declared starved for as long as the subsampling lasted.ExpectedReceivedFrames: How many frames the SDK expected the closure to deliver to the host, fromNucCycleReport.RequestedCameraFramesand the share. Compare againstNucCycleReport.FramesKept+NucCycleReport.FramesDiscarded; a gap is the host losing frames inside the closure.CameraCounterSpan: How far the camera's own frame counter advanced across the closure. The only quantity on the frame that says how many frames there were rather than how many arrived. Zero when the stream format carries no counter.FramesKept: Shut-flag frames the pipeline accumulated into the new reference.FramesDiscarded: Shut-flag frames deliberately thrown away at the start of the closure, because the flag was still moving when their telemetry was sampled.FramesRejectedNotShut: Frames the accumulation refused because the camera did not report the flag shut on them: scene frames that a window-based accumulation would have averaged into the dark reference. Non-zero means the closure and the frames arriving inside it had come out of step.FramesTarget: How many kept frames the cycle was aiming for.FramesFloor: The floorNucCycleReport.FramesKeptwas judged against. Below it the cycle is discarded.Capture: How long the accumulation ran.EndedAtReopen: Whether the capture ended because the camera's counter said its closure was spent, rather than because its frames were in hand. True means the shutter reopened before the capture had what it needed. Always false whenNucCycleReport.CameraCounterSpanis 0.Timestamp: When the decision was taken, on the SDK's monotonic clock. For timing;NucCycleReport.HostTimeis for dating.HostTime: The same moment as a date. Read in the same breath asNucCycleReport.Timestampand not derived from it: that clock is monotonic and this one is not.Sequence: Cycles reported on this camera, from 1. A consumer that missed one can tell. Zero in the placeholderThermalCamera.LastNucCyclereturns before the first cycle, seeNucCycleReport.HasReport.
Delivered to the handler given to ThermalCamera.OnNucCycle(…), once per cycle that reached a decision, at the moment the decision is taken. ThermalCamera.LastNucCycle returns the most recent one, for a handler installed after a cycle had already happened.
Every number here was already computed, once per cycle, and went only to the SDK's log. A fifteen-camera host reported the symptom this is for: 24 cycles on one camera that all logged "Finalizing with 8 frames" and were indistinguishable from 24 good ones, while the tile showed a near-uniform field: a dark reference averaged from frames of the scene. The quantity that separates a slow camera from a host losing frames was unreachable, because every rate the SDK publishes is measured where frames arrive, so the two are identical on a clock.
A cycle taken over by a process interface, or cut short by a mode switch, a reconnect or shutdown, never reaches a decision and reports nothing. NucCycleReport.Sequence is how a consumer sees that: it counts cycles reported, so it does not advance.
Example
camera.OnNucCycle(cycle => { if (cycle.Outcome != NucCycleOutcome.DiscardedTooFewFrames) { return; } // Which of the two it is decides what to do about it, and the // share is the only thing that can say. string cause = cycle.DeliveryShare switch { null => "the camera carries no frame counter, so this host " + "cannot be measured", < 0.9f => $"the host received {cycle.DeliveryShare:P0} of " + "this camera's frames", _ => "the host received the camera's frames; the closure " + "itself was short", }; log.WriteLine($"NUC discarded: {cycle.FramesKept} of " + $"{cycle.FramesFloor} needed: {cause}"); });
NucCycleReport: properties
public uint CameraCounterSpan { get; init; }
How far the camera's own frame counter advanced across the closure. The only quantity on the frame that says how many frames there were rather than how many arrived. Zero when the stream format carries no counter.
public TimeSpan Capture { get; init; }
How long the accumulation ran.
public Nullable<float> DeliveryShare { get; init; }
Arrivals per frame the camera took, over the frames before this cycle, or null when the camera could not be measured at all.
Null is the answer "nobody could measure it", and it is not the same as 1. A camera whose stream format carries no frame counter cannot be measured, and the SDK itself reads such a camera as a share of 1: the value it assumed unconditionally before any of this existed, so an unmeasurable camera keeps exactly its old closure. The two cases mean opposite things about whether a short cycle is the host's fault, which is why this is a nullable rather than a 0 a reader would have to know about. 1 means "measured, and every frame arrived".
Counted where the transport hands the frame over, ahead of the subsampling and export gates, because those drop frames deliberately: measured after them a camera subsampled to 8 Hz would report 0.125 and be declared starved for as long as the subsampling lasted.
public bool EndedAtReopen { get; init; }
Whether the capture ended because the camera's counter said its closure was spent, rather than because its frames were in hand. True means the shutter reopened before the capture had what it needed. Always false when NucCycleReport.CameraCounterSpan is 0.
public uint ExpectedReceivedFrames { get; init; }
How many frames the SDK expected the closure to deliver to the host, from NucCycleReport.RequestedCameraFrames and the share. Compare against NucCycleReport.FramesKept + NucCycleReport.FramesDiscarded; a gap is the host losing frames inside the closure.
public uint FramesDiscarded { get; init; }
Shut-flag frames deliberately thrown away at the start of the closure, because the flag was still moving when their telemetry was sampled.
public uint FramesFloor { get; init; }
The floor NucCycleReport.FramesKept was judged against. Below it the cycle is discarded.
public uint FramesKept { get; init; }
Shut-flag frames the pipeline accumulated into the new reference.
public uint FramesReceived { get; }
How many frames the closure delivered to the host, kept and discarded together.
The number to compare against NucCycleReport.ExpectedReceivedFrames. Frames in NucCycleReport.FramesRejectedNotShut are deliberately not counted: they arrived, but not from a closed shutter, so they were never part of this closure.
public uint FramesRejectedNotShut { get; init; }
Frames the accumulation refused because the camera did not report the flag shut on them: scene frames that a window-based accumulation would have averaged into the dark reference. Non-zero means the closure and the frames arriving inside it had come out of step.
public uint FramesTarget { get; init; }
How many kept frames the cycle was aiming for.
public bool HasReport { get; }
Whether anything has been reported on this camera at all.
false only for the placeholder ThermalCamera.LastNucCycle returns before the first decided cycle, which is also the answer for a simulated camera, for a recording, and for a camera whose every cycle so far was abandoned. Every delivered report is true.
public DateTimeOffset HostTime { get; init; }
The same moment as a date. Read in the same breath as NucCycleReport.Timestamp and not derived from it: that clock is monotonic and this one is not.
public NucCycleOutcome Outcome { get; init; }
What the cycle did to the dark reference.
public TimeSpan PlannedFramePeriod { get; init; }
The frame period the closure was planned at, measured where frames arrive. Carried because it is the input the plan was wrong about: on a host losing frames it is longer than the camera's, and a closure computed from it alone came out shorter than a healthy one: 25 frames at 32 Hz, 24 at 21, 21 at 10.
public bool ReferenceWasTaken { get; }
Whether a new dark reference came out of this cycle.
The question most callers ask, answered once here so that nobody has to enumerate the outcomes and get it wrong when another is added.
public uint RequestedCameraFrames { get; init; }
The closure the SDK asked the camera for, in the camera's own frames. The hardware is handed a count of its own frames and reopens by itself after that many; the SDK never commands the reopen. So this is not comparable with the received-frame counts, and the two being different units is the defect this pair was separated to prevent. The conversion between them is NucCycleReport.DeliveryShare.
public ulong Sequence { get; init; }
Cycles reported on this camera, from 1. A consumer that missed one can tell. Zero in the placeholder ThermalCamera.LastNucCycle returns before the first cycle, see NucCycleReport.HasReport.
public TimeSpan Timestamp { get; init; }
When the decision was taken, on the SDK's monotonic clock. For timing; NucCycleReport.HostTime is for dating.