Report capacity reserve and assign a small reliability label.

capacity-reserve-report A reserve report keeps the arithmetic visible before assigning a status label.

Capacity Reserve Reliability Report

demand
capacity_reserve_reliability_report.rb
Replay: real traced execution (multi-file project)
demand = 72
capacity = 100
reserve = capacity - demand
status = "stable"

if reserve < 15
  status = "watch"
end

if reserve < 8
  status = "tight"
end

puts "demand=#{demand}"
puts "reserve=#{reserve}"
puts "status=#{status}"
demand = 88
capacity = 100
reserve = capacity - demand
status = "stable"

if reserve < 15
  status = "watch"
end

if reserve < 8
  status = "tight"
end

puts "demand=#{demand}"
puts "reserve=#{reserve}"
puts "status=#{status}"
demand = 95
capacity = 100
reserve = capacity - demand
status = "stable"

if reserve < 15
  status = "watch"
end

if reserve < 8
  status = "tight"
end

puts "demand=#{demand}"
puts "reserve=#{reserve}"
puts "status=#{status}"
  1. demand ← 72, capacity ← 100, reserve ← 28, status ← stable

    1demand→ 72 = 72 #@demand=88, 952capacity→ 100 = 1003reserve→ 28 = capacity100 - demand724status→ stable = "stable"56if reserve < 157  status = "watch"8end910if reserve < 811  status = "tight"12end1314puts "demand=#{demand72}"15puts "reserve=#{reserve28}"16puts "status=#{statusstable}"
    outputdemand=72
    reserve=28
    status=stable
  1. demand ← 88, capacity ← 100, reserve ← 12, status ← stable

    1demand→ 88 = 882capacity→ 100 = 1003reserve→ 12 = capacity100 - demand884status→ stable = "stable"
  2. status ← watch

    6if reserve12 < 157  status→ watch = "watch"8end
  3. puts "demand=#{demand}"

    14puts "demand=#{demand88}"15puts "reserve=#{reserve12}"16puts "status=#{statuswatch}"
    outputdemand=88
    reserve=12
    status=watch
  1. demand ← 95, capacity ← 100, reserve ← 5, status ← stable

    1demand→ 95 = 952capacity→ 100 = 1003reserve→ 5 = capacity100 - demand954status→ stable = "stable"
  2. status ← watch

    6if reserve5 < 157  status→ watch = "watch"8end
  3. status ← tight

    10if reserve5 < 811  status→ tight = "tight"12end
  4. puts "demand=#{demand}"

    14puts "demand=#{demand95}"15puts "reserve=#{reserve5}"16puts "status=#{statustight}"
    outputdemand=95
    reserve=5
    status=tight