492 |
array set info [list total-in 0 total-out 0 daily-in 0 daily-out 0 restart [unixtime]] |
array set info [list total-in 0 total-out 0 daily-in 0 daily-out 0 restart [unixtime]] |
493 |
} |
} |
494 |
# Increase the counters: |
# Increase the counters: |
495 |
if {($bytes) && ($direction == {in} || $direction == {out})} { |
if {$bytes} { |
496 |
incr info(total-$direction) $bytes |
incr info(total-$direction) $bytes |
497 |
incr info(daily-$direction) $bytes |
incr info(daily-$direction) $bytes |
498 |
} |
} |
502 |
} |
} |
503 |
# Write the new counts back to the Traffic variable: |
# Write the new counts back to the Traffic variable: |
504 |
set Traffic($type) [array get info] |
set Traffic($type) [array get info] |
505 |
if {$direction == {in} || $direction == {out}} { |
if {$direction != {}} { |
506 |
# Return either in or out for $type: |
# Return either in or out for $type: |
507 |
list $info(daily-$direction) $info(total-$direction) |
list $info(daily-$direction) $info(total-$direction) |
508 |
} else { |
} else { |
520 |
incr total(daily-out) $info(daily-out) |
incr total(daily-out) $info(daily-out) |
521 |
incr total(daily-in) $info(daily-in) |
incr total(daily-in) $info(daily-in) |
522 |
} |
} |
523 |
lappend out [list Total $total(daily-in) $total(total-in) $total(daily-out) $total(total-out)] |
list Total $total(daily-in) $total(total-in) $total(daily-out) $total(total-out) |
|
return $out |
|
524 |
} |
} |
525 |
} |
} |
526 |
|
|