}
-#****f* exec.tcl/nexec_monitor
-# NAME
-# nexec_monitor -- execute monitor
-# SYNOPSIS
-# set result [nexec_monitor $args]
-# FUNCTION
-# Executes the sting given in args variable. The sting is not executed
-# if IMUNES is running in editor only mode. Execution of a string can
-# be local or remote. Opens a monitor socket if it is not yet opened.
-# Sends the arguments to monitor socket if the remote execution is
-# selected, otherwise executes arguments locally.
-# INPUTS
-# * args -- the string that should be executed locally or remotely.
-# RESULT
-# * result -- the standard output of the executed string.
-#****
-proc nexec_monitor { args } {
- global remote_exec editor_only
- global monSock
-
- if { $remote_exec } {
- if { ![info exists monSock] || $monSock == "" } {
- remoteStart
- }
- }
-
- if { $editor_only } {
- tk_messageBox -title "Editor only" \
- -message "Running in editor only mode. Cannot execute commands. Please report this problem." \
- -type ok
- exit 5
- }
-
- if { $remote_exec } {
- rexec $monSock $args
- } else {
- eval exec $args
- }
-}
-
-
-
#****f* exec.tcl/setOperMode
# NAME
# setOperMode -- set operating mode
#****
proc setOperMode { mode } {
global oper_mode activetool node_list
- global nmbufs nmbclusters
global editor_only remote_exec execSock
global undolevel redolevel
.menubar.edit entryconfigure "Undo" -state disabled
.menubar.edit entryconfigure "Redo" -state disabled
set oper_mode exec
- set nmbufs [lindex [split [nexec sysctl kern.ipc.nmbufs]] 1]
- set nmbclusters [lindex [split [nexec sysctl kern.ipc.nmbclusters]] 1]
- monitor_loop
if { $remote_exec } {
nexec create_conf_file config.imn
dumpCfg file $execSock
}
-#****f* exec.tcl/monitor_loop
-# NAME
-# monitor_loop -- monitor loop
-# SYNOPSIS
-# monitor_loop
-# FUNCTION
-# Calculates the usage of cpu, mbuffers and mbuf clusters.
-# The results are displayed in status line and updated
-# every two seconds.
-#****
-proc monitor_loop {} {
- global oper_mode
- global nmbufs nmbclusters
-
- if {$oper_mode != "exec"} {
- .bottom.cpu_load config -text ""
- .bottom.mbuf config -text ""
- return
- }
-
- set cpu_load [expr ([lindex [split [nexec_monitor sysctl kern.cp_time_avg]] end] + \
- 5000) / 10000]
- .bottom.cpu_load config -text "CPU $cpu_load%"
-
- set nstout [split [nexec_monitor netstat -m] ]
- set mbufs [lindex [split [lindex $nstout 0] /] 0]
- set clusts [lindex [split [lsearch -inline $nstout "*/$nmbclusters"] /] 0]
- set mbufp [expr $mbufs * 100 / $nmbufs]
- set clustp [expr $clusts * 100 / $nmbclusters]
- .bottom.mbuf config -text "mbuf/clus $mbufp%/$clustp%"
-
- after 2000 { monitor_loop }
-}
-
-
#****f* exec.tcl/execSetIfcQDisc
# NAME
# execSetIfcQDisc -- in exec mode set interface queuing discipline