Filter a small incident queue by minimum severity and count high-severity items.

visible incident The visible count tracks how many queue entries meet the current report threshold.
high severity High-severity incidents are counted separately so operators can scan risk quickly.

Incident Queue Reliability Report

minimumSeverity
incident_queue_reliability_report.c
Replay: real traced execution (multi-file project)
#include <stdio.h>

int main(void) {
    int minimumSeverity = 2;
    int severities[4] = {1, 2, 3, 3};
    int visible = 0;
    int high = 0;

    for (int i = 0; i < 4; i++) {
        if (severities[i] >= minimumSeverity) {
            visible++;
        }

        if (severities[i] >= 3) {
            high++;
        }
    }

    printf("minimum=%d\n", minimumSeverity);
    printf("visible=%d\n", visible);
    printf("high=%d\n", high);
    return 0;
}
#include <stdio.h>

int main(void) {
    int minimumSeverity = 1;
    int severities[4] = {1, 2, 3, 3};
    int visible = 0;
    int high = 0;

    for (int i = 0; i < 4; i++) {
        if (severities[i] >= minimumSeverity) {
            visible++;
        }

        if (severities[i] >= 3) {
            high++;
        }
    }

    printf("minimum=%d\n", minimumSeverity);
    printf("visible=%d\n", visible);
    printf("high=%d\n", high);
    return 0;
}
#include <stdio.h>

int main(void) {
    int minimumSeverity = 3;
    int severities[4] = {1, 2, 3, 3};
    int visible = 0;
    int high = 0;

    for (int i = 0; i < 4; i++) {
        if (severities[i] >= minimumSeverity) {
            visible++;
        }

        if (severities[i] >= 3) {
            high++;
        }
    }

    printf("minimum=%d\n", minimumSeverity);
    printf("visible=%d\n", visible);
    printf("high=%d\n", high);
    return 0;
}
  1. minimumSeverity ← 2, severities ← ⟨addr A⟩, visible ← 0, high ← 0

    3int main(void) {4    int minimumSeverity→ 2 = 2; //@minimumSeverity=1, 35    int severities→ ⟨addr A⟩[4] = {1, 2, 3, 3};6    int visible→ 0 = 0;7    int high→ 0 = 0;
  2. for (int i = 0; i < 4; i++)

    pass 1 of 4
    9for (int i0 = 0; i < 4; i++) {10    if (severities[i] >= minimumSeverity) {
    All 4 passes — pass 1 is the card above
    passiseverities[i]high
    10
    21
    3230 1
    4331 2
  3. visible ← 1

    pass 1 of 3
    9for (int i = 0; i < 4; i++) {10    if (severities[i]2 >= minimumSeverity2) {11        visible→ 1++;12    }
    All 3 passes — pass 1 is the card above
    passseverities[i]visiblehigh
    120 1
    231 20 1
    332 31 2
  4. high ← 1

    pass 1 of 2
    14if (severities[i]3 >= 3) {15    high→ 1++;16}
  5. high ← 2

    pass 2 of 2
    14if (severities[i]3 >= 3) {15    high→ 2++;16}
  6. printf("minimum=%d ", minimumSeverity);

    19    printf("minimum=%d\n", minimumSeverity2);20    printf("visible=%d\n", visible3);21    printf("high=%d\n", high2);22    return 0;23}
    outputminimum=2
    visible=3
    high=2
  1. minimumSeverity ← 1, severities ← ⟨addr A⟩, visible ← 0, high ← 0

    3int main(void) {4    int minimumSeverity→ 1 = 1;5    int severities→ ⟨addr A⟩[4] = {1, 2, 3, 3};6    int visible→ 0 = 0;7    int high→ 0 = 0;
  2. for (int i = 0; i < 4; i++)

    pass 1 of 4
    9for (int i0 = 0; i < 4; i++) {10    if (severities[i] >= minimumSeverity) {
    All 4 passes — pass 1 is the card above
    passiseverities[i]high
    10
    21
    3230 1
    4331 2
  3. visible ← 1

    pass 1 of 4
    9for (int i = 0; i < 4; i++) {10    if (severities[i]1 >= minimumSeverity1) {11        visible→ 1++;12    }
    All 4 passes — pass 1 is the card above
    passseverities[i]visiblehigh
    110 1
    221 2
    332 30 1
    433 41 2
  4. high ← 1

    pass 1 of 2
    14if (severities[i]3 >= 3) {15    high→ 1++;16}
  5. high ← 2

    pass 2 of 2
    14if (severities[i]3 >= 3) {15    high→ 2++;16}
  6. printf("minimum=%d ", minimumSeverity);

    19    printf("minimum=%d\n", minimumSeverity1);20    printf("visible=%d\n", visible4);21    printf("high=%d\n", high2);22    return 0;23}
    outputminimum=1
    visible=4
    high=2
  1. minimumSeverity ← 3, severities ← ⟨addr A⟩, visible ← 0, high ← 0

    3int main(void) {4    int minimumSeverity→ 3 = 3;5    int severities→ ⟨addr A⟩[4] = {1, 2, 3, 3};6    int visible→ 0 = 0;7    int high→ 0 = 0;
  2. for (int i = 0; i < 4; i++)

    pass 1 of 4
    9for (int i0 = 0; i < 4; i++) {10    if (severities[i] >= minimumSeverity) {
    All 4 passes — pass 1 is the card above
    passiseverities[i]minimumSeverityvisiblehigh
    10
    21
    32330 10 1
    43331 21 2
  3. visible ← 1

    pass 1 of 2
    9for (int i = 0; i < 4; i++) {10    if (severities[i]3 >= minimumSeverity3) {11        visible→ 1++;12    }
  4. high ← 1

    pass 1 of 2
    14if (severities[i]3 >= 3) {15    high→ 1++;16}
  5. visible ← 2

    pass 2 of 2
    9for (int i = 0; i < 4; i++) {10    if (severities[i]3 >= minimumSeverity3) {11        visible→ 2++;12    }
  6. high ← 2

    pass 2 of 2
    14if (severities[i]3 >= 3) {15    high→ 2++;16}
  7. printf("minimum=%d ", minimumSeverity);

    19    printf("minimum=%d\n", minimumSeverity3);20    printf("visible=%d\n", visible2);21    printf("high=%d\n", high2);22    return 0;23}
    outputminimum=3
    visible=2
    high=2