-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# display load avg on Linux | ||
|
||
package require ukaz | ||
package require fileutil | ||
|
||
pack [ukaz::graph .l] -expand yes -fill both | ||
|
||
set lastload {0 0} | ||
set time 0 | ||
|
||
proc newload {} { | ||
variable lastload | ||
variable time | ||
variable graphid | ||
|
||
# read current loadavg last 1, 5 and 15 minutes | ||
lassign [fileutil::read /proc/loadavg] l1 l5 l15 | ||
|
||
incr time | ||
lappend lastload $time $l1 | ||
|
||
if {[llength $lastload]>1000} { | ||
# for more than 1000 entries, cut it down | ||
set lastload [lrange $lastload end-999 end] | ||
} | ||
.l update $graphid data $lastload | ||
after 500 newload | ||
} | ||
|
||
set graphid [.l plot $lastload with lines color red title "CPU load"] | ||
.l set xlabel "Time" | ||
.l set ylabel "Load" | ||
|
||
newload |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.