Compute reserve capacity and label how tightly a service is running.

capacity reserve Capacity reserve is the difference between a planned limit and current demand. The report maps that reserve to a stable operator label.

Capacity Reserve Reliability Report

demand
CapacityReserveReliabilityReport.cs
Replay: real traced execution (multi-file project)
using System;

class Program
{
    static string ReserveLabel(int reserve)
    {
        if (reserve <= 5)
        {
            return "tight";
        }

        if (reserve <= 20)
        {
            return "watch";
        }

        return "stable";
    }

    static void Main()
    {
        int limit = 100;
        int demand = 72;
        int reserve = limit - demand;
        string status = ReserveLabel(reserve);

        Console.WriteLine("demand=" + demand);
        Console.WriteLine("reserve=" + reserve);
        Console.WriteLine("status=" + status);
    }
}
using System;

class Program
{
    static string ReserveLabel(int reserve)
    {
        if (reserve <= 5)
        {
            return "tight";
        }

        if (reserve <= 20)
        {
            return "watch";
        }

        return "stable";
    }

    static void Main()
    {
        int limit = 100;
        int demand = 88;
        int reserve = limit - demand;
        string status = ReserveLabel(reserve);

        Console.WriteLine("demand=" + demand);
        Console.WriteLine("reserve=" + reserve);
        Console.WriteLine("status=" + status);
    }
}
using System;

class Program
{
    static string ReserveLabel(int reserve)
    {
        if (reserve <= 5)
        {
            return "tight";
        }

        if (reserve <= 20)
        {
            return "watch";
        }

        return "stable";
    }

    static void Main()
    {
        int limit = 100;
        int demand = 95;
        int reserve = limit - demand;
        string status = ReserveLabel(reserve);

        Console.WriteLine("demand=" + demand);
        Console.WriteLine("reserve=" + reserve);
        Console.WriteLine("status=" + status);
    }
}
  1. limit ← 100, demand ← 72, reserve ← 28

    20static void Main()21{22    int limit→ 100 = 100;23    int demand→ 72 = 72; //@demand=88, 9524    int reserve→ 28 = limit100 - demand72;25    string status = ReserveLabel(reserve28);
  2. static string ReserveLabel(int reserve)

    4{5    static string ReserveLabel(int reserve28)6    {7        if (reserve <= 5)8        {9            return "tight";10        }1112        if (reserve <= 20)13        {14            return "watch";15        }1617        return "stable";18    }
  3. status ← stable

    24    int reserve = limit - demand;25    string status→ stable = ReserveLabel(reserve28);2627    Console.WriteLine("demand=" + demand72);28    Console.WriteLine("reserve=" + reserve28);29    Console.WriteLine("status=" + statusstable);30}
    outputdemand=72
    reserve=28
    status=stable
  1. limit ← 100, demand ← 88, reserve ← 12

    20static void Main()21{22    int limit→ 100 = 100;23    int demand→ 88 = 88;24    int reserve→ 12 = limit100 - demand88;25    string status = ReserveLabel(reserve12);
  2. static string ReserveLabel(int reserve)

    4{5    static string ReserveLabel(int reserve12)6    {7        if (reserve <= 5)
  3. if (reserve <= 20)

    12if (reserve12 <= 20)13{14    return "watch";15}
  4. status ← watch

    24    int reserve = limit - demand;25    string status→ watch = ReserveLabel(reserve12);2627    Console.WriteLine("demand=" + demand88);28    Console.WriteLine("reserve=" + reserve12);29    Console.WriteLine("status=" + statuswatch);30}
    outputdemand=88
    reserve=12
    status=watch
  1. limit ← 100, demand ← 95, reserve ← 5

    20static void Main()21{22    int limit→ 100 = 100;23    int demand→ 95 = 95;24    int reserve→ 5 = limit100 - demand95;25    string status = ReserveLabel(reserve5);
  2. static string ReserveLabel(int reserve)

    4{5    static string ReserveLabel(int reserve5)6    {7        if (reserve <= 5)
  3. if (reserve <= 5)

    6{7    if (reserve5 <= 5)8    {9        return "tight";10    }
  4. status ← tight

    24    int reserve = limit - demand;25    string status→ tight = ReserveLabel(reserve5);2627    Console.WriteLine("demand=" + demand95);28    Console.WriteLine("reserve=" + reserve5);29    Console.WriteLine("status=" + statustight);30}
    outputdemand=95
    reserve=5
    status=tight