$1 == "OK" && \
$2 == "khatus_sensor_datetime" {
+ # Code for make_status_bar definition is expected to be passed as an
+ # additional source file, using -f flag.
print_msg_ok("status_bar", make_status_bar())
}
split(src_and_key, parts, SUBSEP)
src = parts[1]
key = parts[2]
+ val = _cache[src, key]
unused_for = cache_get_time() - _cache_atime[src, key]
if (unused_for > GC_Interval) {
print_msg_info(\
"cache_gc",
- sprintf("Deleting unused data SRC=%s KEY=%s", src, key) \
+ sprintf(\
+ "Deleting unused data SRC=%s KEY=%s VAL=%s",
+ src, key, val\
+ ) \
)
delete _cache[src, key]
}
# Status bar
# -----------------------------------------------------------------------------
-function make_status_bar( position, bar, sep, i, j) {
- position[++i] = ""
- position[++i] = make_status_energy()
- position[++i] = make_status_mem()
- position[++i] = make_status_cpu()
- position[++i] = make_status_disk()
- position[++i] = make_status_net()
- position[++i] = make_status_bluetooth()
- position[++i] = make_status_screen_brightness()
- position[++i] = make_status_volume()
- position[++i] = make_status_mpd()
- position[++i] = make_status_weather()
- position[++i] = make_status_datetime()
- position[++i] = ""
- bar = ""
- sep = ""
- for (j = 1; j <= i; j++) {
- bar = bar sep position[j]
- sep = " "
- }
- return bar
-}
-
function make_status_energy( state, charge, direction_of_change) {
cache_get(state , "khatus_sensor_energy", "battery_state" , 0)
cache_get(charge, "khatus_sensor_energy", "battery_percentage", 0)
return sprintf("M=%s", status)
}
+function make_status_procs() {
+ src = "khatus_sensor_procs"
+ all = cache_get_fmt_def(src, "total_procs" , 15, "%d")
+ r = cache_get_fmt_def(src, "total_per_state" Kfs "R", 15, "%d", "0")
+ d = cache_get_fmt_def(src, "total_per_state" Kfs "D", 15, "%d", "0")
+ t = cache_get_fmt_def(src, "total_per_state" Kfs "T", 15, "%d", "0")
+ i = cache_get_fmt_def(src, "total_per_state" Kfs "I", 15, "%d", "0")
+ z = cache_get_fmt_def(src, "total_per_state" Kfs "Z", 15, "%d", "0")
+ return sprintf("P=[%s %sr %sd %st %si %sz]", all, r, d, t, i, z)
+}
+
function make_status_cpu( l, t, f) {
l_src = "khatus_sensor_loadavg"
t_src = "khatus_sensor_temperature"