ns::stats::Sampler method calculate (public)
<instance of ns::stats::Sampler> calculate current previous \ interval instance
Derive interval diagnostics from current and previous snapshots. Return the current observations augmented with counter deltas, rates, average request phase times and thread CPU percentages. Rates use measured elapsed time; interval records the configured sampling cadence, and instance identifies the sampler lifetime. Interval results require a previous snapshot from the same process lifetime and positive elapsed time. Missing baselines or decreased counters yield empty derived values. CPU comparisons match thread identifiers and creation times; percentages use one core as 100%. Does not collect observations or modify shared state.
- Parameters:
- current (required)
- Current snapshot dictionary, including its epoch-microsecond timestamp and process identity.
- previous (required)
- Previous snapshot dictionary, or empty when no baseline exists.
- interval (required)
- Configured sampling cadence in seconds; rates use actual elapsed time instead.
- instance (required)
- Sampler lifetime identifier attached to the calculated sample.
- Returns:
- Current observations augmented with sampling metadata, counter deltas, rates, average timings and CPU percentages; unavailable derived values remain empty.
- Testcases:
- No testcase defined.
![[i]](/resources/acs-subsite/ZoomIn16.gif)