nsmcp::ServerRuntime object method schedulerComparison (public)
nsmcp::ServerRuntimeschedulerComparison previous current
Defined in /usr/local/ns/tcl/nsmcp/stats-tools.tcl
Compare scheduler counters from two observations of the same process.
- Parameters:
- previous (required)
- Previous observation, or empty if no baseline exists.
- current (required)
- Current observation and its process identity.
- Returns:
- Interval deltas and explicit reasons for unavailable metrics.
- Testcases:
- No testcase defined.
Source code: set result [dict create available false scope process baselineSource previous-server-runtime-call to [dict get $current observedAt]] if {$previous eq ""} { dict set result reason no-baseline return $result } dict set result from [dict get $previous observedAt] if {[dict get $previous identity] ne [dict get $current identity]} { dict set result reason process-changed return $result } set elapsed [expr {[dict get $current observedAt]-[dict get $previous observedAt]}] if {$elapsed <= 0} { dict set result reason nonpositive-interval return $result } dict set result elapsedSeconds $elapsed dict set result available true set metrics {} foreach phase {waitReturnLateness mutexAcquisition nonThreadedCallbacks dispatchLateness dispatchDelay workerQueueDelay threadedCallbacks callbackOverrun} { set entry [dict create available false] if {![dict exists $previous counters $phase] || ![dict exists $current counters $phase]} { dict set entry reason phase-unavailable } else { set a [dict get $previous counters $phase] set b [dict get $current counters $phase] set valid true foreach field {count over100ms totalSeconds maxSeconds} { if {![dict exists $a $field] || ![dict exists $b $field] || ![string is double -strict [dict get $a $field]] || ![string is double -strict [dict get $b $field]]} { set valid false break } } if {!$valid} { dict set entry reason counters-unavailable } elseif {[dict get $b count] < [dict get $a count] || [dict get $b over100ms] < [dict get $a over100ms] || [dict get $b totalSeconds] < [dict get $a totalSeconds] || [dict get $b maxSeconds] < [dict get $a maxSeconds]} { dict set entry reason counters-reset } else { set count [expr {[dict get $b count]-[dict get $a count]}] set total [expr {[dict get $b totalSeconds]-[dict get $a totalSeconds]}] dict set entry available true dict set entry observationsDelta $count dict set entry over100msDelta [expr {[dict get $b over100ms]-[dict get $a over100ms]}] dict set entry totalSecondsDelta $total dict set entry averageSeconds [expr {$count > 0 ? $total/double($count) : ""}] dict set entry newMaximum [expr {[dict get $b maxSeconds] > [dict get $a maxSeconds]}] } } dict set metrics $phase $entry } dict set result metrics $metrics dict set result limitations {Deltas cover all scheduler jobs in this observation interval, not the warning query window or a specific callback. A positive over100msDelta shows threshold crossings during the interval; the lifetime maximum callback does not attribute smaller observations. newMaximum identifies only a newly increased lifetime maximum; use current counters for its callback and observation time. Zero over100msDelta excludes only observations above that threshold, not all delay. Baselines are shared by server_runtime callers on this virtual server and updated on each successful scheduler read; concurrent or nonpositive observation intervals are unavailable. Worker/queue values remain current gauges; peaks remain lifetime maxima.} return $resultXQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)