Compare observed latency with a target and classify the current budget state.

latency budget A latency budget report makes the comparison between observed latency and the target explicit before assigning the final status label.

Latency Budget Reliability Report

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

class Program
{
    static string LatencyStatus(int observedMs, int targetMs)
    {
        if (observedMs > targetMs)
        {
            return "slow";
        }

        if (observedMs > targetMs - 40)
        {
            return "watch";
        }

        return "fast";
    }

    static void Main()
    {
        int targetMs = 200;
        int observedMs = 180;
        string status = LatencyStatus(observedMs, targetMs);

        Console.WriteLine("observed=" + observedMs);
        Console.WriteLine("target=" + targetMs);
        Console.WriteLine("status=" + status);
    }
}
using System;

class Program
{
    static string LatencyStatus(int observedMs, int targetMs)
    {
        if (observedMs > targetMs)
        {
            return "slow";
        }

        if (observedMs > targetMs - 40)
        {
            return "watch";
        }

        return "fast";
    }

    static void Main()
    {
        int targetMs = 200;
        int observedMs = 120;
        string status = LatencyStatus(observedMs, targetMs);

        Console.WriteLine("observed=" + observedMs);
        Console.WriteLine("target=" + targetMs);
        Console.WriteLine("status=" + status);
    }
}
using System;

class Program
{
    static string LatencyStatus(int observedMs, int targetMs)
    {
        if (observedMs > targetMs)
        {
            return "slow";
        }

        if (observedMs > targetMs - 40)
        {
            return "watch";
        }

        return "fast";
    }

    static void Main()
    {
        int targetMs = 200;
        int observedMs = 260;
        string status = LatencyStatus(observedMs, targetMs);

        Console.WriteLine("observed=" + observedMs);
        Console.WriteLine("target=" + targetMs);
        Console.WriteLine("status=" + status);
    }
}
  1. targetMs ← 200, observedMs ← 180

    20static void Main()21{22    int targetMs→ 200 = 200;23    int observedMs→ 180 = 180; //@observedMs=120, 26024    string status = LatencyStatus(observedMs180, targetMs200);
  2. static string LatencyStatus(int observedMs, int targetMs)

    4{5    static string LatencyStatus(int observedMs180, int targetMs200)6    {7        if (observedMs > targetMs)
  3. if (observedMs > targetMs - 40)

    12if (observedMs180 > targetMs200 - 40)13{14    return "watch";15}
  4. status ← watch

    23    int observedMs = 180; //@observedMs=120, 26024    string status→ watch = LatencyStatus(observedMs180, targetMs200);2526    Console.WriteLine("observed=" + observedMs180);27    Console.WriteLine("target=" + targetMs200);28    Console.WriteLine("status=" + statuswatch);29}
    outputobserved=180
    target=200
    status=watch
  1. targetMs ← 200, observedMs ← 120

    20static void Main()21{22    int targetMs→ 200 = 200;23    int observedMs→ 120 = 120;24    string status = LatencyStatus(observedMs120, targetMs200);
  2. static string LatencyStatus(int observedMs, int targetMs)

    4{5    static string LatencyStatus(int observedMs120, int targetMs200)6    {7        if (observedMs > targetMs)8        {9            return "slow";10        }1112        if (observedMs > targetMs - 40)13        {14            return "watch";15        }1617        return "fast";18    }
  3. status ← fast

    23    int observedMs = 120;24    string status→ fast = LatencyStatus(observedMs120, targetMs200);2526    Console.WriteLine("observed=" + observedMs120);27    Console.WriteLine("target=" + targetMs200);28    Console.WriteLine("status=" + statusfast);29}
    outputobserved=120
    target=200
    status=fast
  1. targetMs ← 200, observedMs ← 260

    20static void Main()21{22    int targetMs→ 200 = 200;23    int observedMs→ 260 = 260;24    string status = LatencyStatus(observedMs260, targetMs200);
  2. static string LatencyStatus(int observedMs, int targetMs)

    4{5    static string LatencyStatus(int observedMs260, int targetMs200)6    {7        if (observedMs > targetMs)
  3. if (observedMs > targetMs)

    6{7    if (observedMs260 > targetMs200)8    {9        return "slow";10    }
  4. status ← slow

    23    int observedMs = 260;24    string status→ slow = LatencyStatus(observedMs260, targetMs200);2526    Console.WriteLine("observed=" + observedMs260);27    Console.WriteLine("target=" + targetMs200);28    Console.WriteLine("status=" + statusslow);29}
    outputobserved=260
    target=200
    status=slow