Skip to content

Commit

Permalink
Restructure for dir for kbskit
Browse files Browse the repository at this point in the history
  • Loading branch information
auriocus committed Jul 4, 2015
1 parent 0bd09be commit 5941441
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions demo/linuxload.tcl
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.

0 comments on commit 5941441

Please sign in to comment.