# example program for using cbval.
#

stripchart .dial -max 100 -min 0 -title "raw"
stripchart .stripchart -max 100 -min 0 -title "smoothed"
scale .alpha -orient horiz
pack append . .dial top 
pack append . .stripchart top
pack append . .alpha top

cbval set foo "debretts.comp.vuw.ac.nz cpu_user" 2000 smooth_dial
#         (1)               (2)                   (3)   (4)
# (1) Symbolic name for callback
# (2) Shared-memory indexing key
# (3) interval (ms)
# (4) command

cbval start foo

set hist 0

proc smooth_dial {name value} {
  global hist
  set alpha [.alpha get]
  .dial set $value
  set hist [expr ((($alpha*$value)+((100-$alpha)*$hist))/100)]
  .stripchart set $hist

}

# cbval stop foo
