!7 cmodule EstimateDiskDoom > DynPrintLogAndEnabled { transient new DoomEstimator estimator; start { estimator.minValue = 3.0; // 3 percent free space doEveryAndNow(60.0, r measure); } void measure enter { double value = 100-diskSpacePercentage_oshi(); printWithTime("Free space: " + formatDouble(value, 3) + " %"); if (!estimator.consumeValue(value)) ret; if (estimator.doomDate == null) ret with setStatus("Hard disk is doom-free!"); long ms = estimator.doomDate-sysNow(); double days = toDays(ms), hours = toHours(ms); S doomText = days >= 2 ? iround(toDays(ms)) + " days from now" : hours >= 2 ? hours + " hours from now" : n2(iround(toMinutes(ms)), "minute") + "from now"; setStatus("DOOM IN " + doomText + " (hard disk " + formatDouble(100-estimator.minValue, 0) + "% full)"); } void setStatus(S s) { setModuleName(print(s)); } }