X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=bin%2Fkhatus_bar;h=9b0fd7f8f18dc259ec61d15e8f4c6a26e1c79c8d;hb=9151826a7517f8c2ae88d74c003570bf30342778;hp=323134cb3d09041b89070cc73e213d4e1b93efe8;hpb=b1c097d6bd0c0b0d0286c6636fe7fda610dfbd45;p=khatus.git diff --git a/bin/khatus_bar b/bin/khatus_bar index 323134c..9b0fd7f 100755 --- a/bin/khatus_bar +++ b/bin/khatus_bar @@ -96,14 +96,18 @@ function cache_get_time( src, key, time) { return time } -function cache_gc( src_and_key, unused_for) { +function cache_gc( src_and_key, parts, src, key, unused_for) { for (src_and_key in _cache) { - unused_for = cache_get_time() - _cache_atime[src_and_key] + split(src_and_key, parts, SUBSEP) + src = parts[1] + key = parts[2] + unused_for = cache_get_time() - _cache_atime[src, key] if (unused_for > 3600) { print_msg_info(\ - "cache_gc", "Deleting unused src_and_key: " src_and_key \ + "cache_gc", + sprintf("Deleting unused SRC=%s KEY=%s", src, key) \ ) - delete _cache[src_and_key] + delete _cache[src, key] } } } @@ -199,9 +203,9 @@ function make_status_cpu( l, t, f) { function make_status_disk( u, w, r, src_u, src_io) { src_u = "khatus_sensor_disk_space" src_io = "khatus_sensor_disk_io" - u = cache_get_fmt_def(src_space, "disk_usage_percentage", 10, "%s") - w = cache_get_fmt_def(src_io , "sectors_written" , 5, "%0.3f") - r = cache_get_fmt_def(src_io , "sectors_read" , 5, "%0.3f") + u = cache_get_fmt_def(src_u , "disk_usage_percentage", 10, "%s") + w = cache_get_fmt_def(src_io, "sectors_written" , 5, "%0.3f") + r = cache_get_fmt_def(src_io, "sectors_read" , 5, "%0.3f") return sprintf("D=[%s%% %s▲ %s▼]", u, w, r) }