Classify remaining reserve from fixed capacity and selected demand.

reserve label Capacity reports are easier to read when raw demand is paired with remaining reserve and a stable, watch, or tight label.

Capacity Reserve Reliability Report

demand
capacity_reserve_reliability_report.go
Replay: real traced execution (multi-file project)
package main

import "fmt"

func main() {
	var demand = 72
	capacity := 100
	reserve := capacity - demand
	status := "tight"

	if reserve >= 20 {
		status = "stable"
	} else if reserve >= 10 {
		status = "watch"
	}

	fmt.Printf("demand=%d reserve=%d status=%s\n", demand, reserve, status)
}
package main

import "fmt"

func main() {
	var demand = 88
	capacity := 100
	reserve := capacity - demand
	status := "tight"

	if reserve >= 20 {
		status = "stable"
	} else if reserve >= 10 {
		status = "watch"
	}

	fmt.Printf("demand=%d reserve=%d status=%s\n", demand, reserve, status)
}
package main

import "fmt"

func main() {
	var demand = 95
	capacity := 100
	reserve := capacity - demand
	status := "tight"

	if reserve >= 20 {
		status = "stable"
	} else if reserve >= 10 {
		status = "watch"
	}

	fmt.Printf("demand=%d reserve=%d status=%s\n", demand, reserve, status)
}
  1. demand ← 72, capacity ← 100, reserve ← 28, status ← "tight"

    5func main() {6  var demand→ 72 = 72 //@demand=88, 957  capacity→ 100 := 1008  reserve→ 28 := capacity100 - demand729  status→ "tight" := "tight"
  2. status ← "stable"

    11if reserve28 >= 20 {12  status→ "stable" = "stable"13} else if reserve >= 10 {
  3. fmt.Printf("demand=%d reserve=%d status=%s ", demand, reserve, status)

    17  fmt.Printf("demand=%d reserve=%d status=%s\n", demand72, reserve28, status"stable")18}
    outputdemand=72 reserve=28 status=stable
  1. demand ← 88, capacity ← 100, reserve ← 12, status ← "tight"

    5func main() {6  var demand→ 88 = 887  capacity→ 100 := 1008  reserve→ 12 := capacity100 - demand889  status→ "tight" := "tight"
  2. status ← "watch"

    12  status = "stable"13} else if reserve12 >= 10 {14  status→ "watch" = "watch"15}
  3. fmt.Printf("demand=%d reserve=%d status=%s ", demand, reserve, status)

    17  fmt.Printf("demand=%d reserve=%d status=%s\n", demand88, reserve12, status"watch")18}
    outputdemand=88 reserve=12 status=watch
  1. demand ← 95, capacity ← 100, reserve ← 5, status ← "tight"

    5func main() {6  var demand→ 95 = 957  capacity→ 100 := 1008  reserve→ 5 := capacity100 - demand959  status→ "tight" := "tight"1011  if reserve >= 20 {12    status = "stable"13  } else if reserve >= 10 {14    status = "watch"15  }1617  fmt.Printf("demand=%d reserve=%d status=%s\n", demand95, reserve5, status"tight")18}
    outputdemand=95 reserve=5 status=tight