Commit cb71e741 authored by Leigh Stoller's avatar Leigh Stoller

Add tb-set-cpu-usage and tb-set-mem-usage tb commands for use with

plab experiments.

Must be an integer between 1 and 1000. Okay, just kidding: 1<=x<=5
parent 89e3b5d4
...@@ -224,6 +224,11 @@ namespace eval GLOBALS { ...@@ -224,6 +224,11 @@ namespace eval GLOBALS {
# Hidden variable to relax some restrictions for debugging. # Hidden variable to relax some restrictions for debugging.
variable enforce_user_restrictions 1 variable enforce_user_restrictions 1
# CPU and MEM usage values. Zero means ignore. For now, lets make
# it an integer, 1 <= x <= 5.
variable cpu_usage 0
variable mem_usage 0
} }
# Load all our classes # Load all our classes
......
...@@ -241,6 +241,8 @@ Simulator instproc run {} { ...@@ -241,6 +241,8 @@ Simulator instproc run {} {
var_import ::GLOBALS::forcelinkdelays var_import ::GLOBALS::forcelinkdelays
var_import ::GLOBALS::multiplex_factor var_import ::GLOBALS::multiplex_factor
var_import ::GLOBALS::sync_server var_import ::GLOBALS::sync_server
var_import ::GLOBALS::cpu_usage
var_import ::GLOBALS::mem_usage
var_import ::TBCOMPAT::objtypes var_import ::TBCOMPAT::objtypes
var_import ::TBCOMPAT::eventtypes var_import ::TBCOMPAT::eventtypes
...@@ -309,8 +311,8 @@ Simulator instproc run {} { ...@@ -309,8 +311,8 @@ Simulator instproc run {} {
$prog updatedb "sql" $prog updatedb "sql"
} }
set fields [list "forcelinkdelays" "uselinkdelays" "usewatunnels" "uselatestwadata" "wa_delay_solverweight" "wa_bw_solverweight" "wa_plr_solverweight" ] set fields [list "mem_usage" "cpu_usage" "forcelinkdelays" "uselinkdelays" "usewatunnels" "uselatestwadata" "wa_delay_solverweight" "wa_bw_solverweight" "wa_plr_solverweight" ]
set values [list $forcelinkdelays $uselinkdelays $usewatunnels $uselatestwadata $wa_delay_solverweight $wa_bw_solverweight $wa_plr_solverweight ] set values [list $mem_usage $cpu_usage $forcelinkdelays $uselinkdelays $usewatunnels $uselatestwadata $wa_delay_solverweight $wa_bw_solverweight $wa_plr_solverweight ]
if { $multiplex_factor != {} } { if { $multiplex_factor != {} } {
lappend fields "multiplex_factor" lappend fields "multiplex_factor"
......
...@@ -680,3 +680,28 @@ proc tb-set-node-startcmd {node command} { ...@@ -680,3 +680,28 @@ proc tb-set-node-startcmd {node command} {
return $newprog return $newprog
} }
#
# More crude controls.
#
proc tb-set-mem-usage {usage} {
var_import ::GLOBALS::mem_usage
if {$usage < 1 || $usage > 5} {
perror "\[tb-set-mem-usage] usage must be 1 <= factor <= 5"
return
}
set mem_usage $usage
}
proc tb-set-cpu-usage {usage} {
var_import ::GLOBALS::cpu_usage
if {$usage < 1 || $usage > 5} {
perror "\[tb-set-cpu-usage] usage must be 1 <= factor <= 5"
return
}
set cpu_usage $usage
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment