ns::stats::Sampler method sample (public)

 <instance of ns::stats::Sampler[i]> sample [ -server server ] \
    [ -window window ]

Defined in

Return the latest published sample, updating its reported age and running state. Before any publication, return a dictionary with sampling readiness false and no interval observations. An optional server argument restricts virtual-server data; CPU measurements remain process-wide. Without -window, does not collect observations or advance the baseline. With -window (0..900 seconds, time units accepted), collect a fresh snapshot and compare it with the nearest retained endpoint to that age (within half a sampling interval). Missing history, gaps or sampler restarts leave readiness false. The measured elapsedSeconds reports the actual selected period. The internal raw baseline is omitted from the returned dictionary.

Switches:
-server (optional)
Optional virtual-server name; empty returns all servers. CPU metrics remain process-wide.
-window (optional, defaults to "0")
Requested display period, accepting ns_baseunit time syntax; 0..900 seconds, default 0 for the latest published sample.
Returns:
Sample dictionary with sampling readiness and age; a positive window adds freshly calculated interval metrics when a suitable continuous baseline exists.

Testcases:
No testcase defined.
[ show source ]
Show another procedure: