ns::stats::Collector method cpuListCount (protected)
<instance of ns::stats::Collector
> cpuListCount text
Defined in
- Parameters:
- text (required)
- Testcases:
-
No testcase defined.
Source code:
set ranges {}
foreach item [split $text ,] {
if {![regexp {^([0-9]+)(?:-([0-9]+))?$} [string trim $item] -> first last]} {
error "Invalid CPU list"
}
if {$last eq ""} {
set last $first
}
if {$last < $first} {
error "Invalid CPU range"
}
lappend ranges [list $first $last]
}
set count 0; set end -1
foreach range [lsort -integer -index 0 $ranges] {
lassign $range first last
if {$last > $end} {
incr count [expr {$last-max($first,$end+1)+1}]
set end $last
}
}
return $count
XQL Not present:Generic, PostgreSQL, Oracle
[
hide source ]
| [
make this the default ]