A queue report can scan compact severity values, count tickets at or above a selected threshold, and keep a separate high-severity total.

Program

Play the program to choose the minimum severity and inspect the queue counts.

min_severity
incident_queue_report.f90
Replay: real traced execution (multi-file project)
program incident_queue_report_demo
    implicit none
    integer :: severities(4)
    integer :: min_severity
    integer :: visible_count
    integer :: high_count
    integer :: i

    severities = [1, 3, 2, 3]
    min_severity = 2
    visible_count = 0
    high_count = 0
    do i = 1, 4
        if (severities(i) >= min_severity) then
            visible_count = visible_count + 1
        end if
        if (severities(i) == 3) then
            high_count = high_count + 1
        end if
    end do
    print '(I0, 1X, I0, 1X, I0)', min_severity, visible_count, high_count
end program incident_queue_report_demo
program incident_queue_report_demo
    implicit none
    integer :: severities(4)
    integer :: min_severity
    integer :: visible_count
    integer :: high_count
    integer :: i

    severities = [1, 3, 2, 3]
    min_severity = 1
    visible_count = 0
    high_count = 0
    do i = 1, 4
        if (severities(i) >= min_severity) then
            visible_count = visible_count + 1
        end if
        if (severities(i) == 3) then
            high_count = high_count + 1
        end if
    end do
    print '(I0, 1X, I0, 1X, I0)', min_severity, visible_count, high_count
end program incident_queue_report_demo
program incident_queue_report_demo
    implicit none
    integer :: severities(4)
    integer :: min_severity
    integer :: visible_count
    integer :: high_count
    integer :: i

    severities = [1, 3, 2, 3]
    min_severity = 3
    visible_count = 0
    high_count = 0
    do i = 1, 4
        if (severities(i) >= min_severity) then
            visible_count = visible_count + 1
        end if
        if (severities(i) == 3) then
            high_count = high_count + 1
        end if
    end do
    print '(I0, 1X, I0, 1X, I0)', min_severity, visible_count, high_count
end program incident_queue_report_demo
  1. severities ← [1, 3, 2, 3]

    9severities = [1, 3, 2, 3]10min_severity = 2
    values this step[1, 3, 2, 3]severities
  2. min_severity ← 2

    9severities = [1, 3, 2, 3]10min_severity = 211visible_count = 0
    values this step2min_severity
  3. visible_count ← 0

    10min_severity = 211visible_count = 012high_count = 0
    values this step0visible_count
  4. high_count ← 0

    11visible_count = 012high_count = 013do i = 1, 4
    values this step0high_count
  5. i ← 1

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step1i
  6. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.false.severities(1) >= min_severity
  7. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.false.severities(1) == 3
  8. i ← 2

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step2i
  9. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.true.severities(2) >= min_severity
  10. visible_count ← 1

    14if (severities(i) >= min_severity) then15    visible_count = visible_count + 116end if
    values this step1visible_count
  11. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.true.severities(2) == 3
  12. high_count ← 1

    17if (severities(i) == 3) then18    high_count = high_count + 119end if
    values this step1high_count
  13. i ← 3

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step3i
  14. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.true.severities(3) >= min_severity
  15. visible_count ← 2

    14if (severities(i) >= min_severity) then15    visible_count = visible_count + 116end if
    values this step2visible_count
  16. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.false.severities(3) == 3
  17. i ← 4

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step4i
  18. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.true.severities(4) >= min_severity
  19. visible_count ← 3

    14if (severities(i) >= min_severity) then15    visible_count = visible_count + 116end if
    values this step3visible_count
  20. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.true.severities(4) == 3
  21. high_count ← 2

    17if (severities(i) == 3) then18    high_count = high_count + 119end if
    values this step2high_count
  22. print '(I0, 1X, I0, 1X, I0)', min_severity, visible_count, high_count

    20    end do21    print '(I0, 1X, I0, 1X, I0)', min_severity, visible_count, high_count22end program incident_queue_report_demo
    output2 3 2
    values this step2min_severity3visible_count2high_count
  1. severities ← [1, 3, 2, 3]

    9severities = [1, 3, 2, 3]10min_severity = 1
    values this step[1, 3, 2, 3]severities
  2. min_severity ← 1

    9severities = [1, 3, 2, 3]10min_severity = 111visible_count = 0
    values this step1min_severity
  3. visible_count ← 0

    10min_severity = 111visible_count = 012high_count = 0
    values this step0visible_count
  4. high_count ← 0

    11visible_count = 012high_count = 013do i = 1, 4
    values this step0high_count
  5. i ← 1

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step1i
  6. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.true.severities(1) >= min_severity
  7. visible_count ← 1

    14if (severities(i) >= min_severity) then15    visible_count = visible_count + 116end if
    values this step1visible_count
  8. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.false.severities(1) == 3
  9. i ← 2

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step2i
  10. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.true.severities(2) >= min_severity
  11. visible_count ← 2

    14if (severities(i) >= min_severity) then15    visible_count = visible_count + 116end if
    values this step2visible_count
  12. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.true.severities(2) == 3
  13. high_count ← 1

    17if (severities(i) == 3) then18    high_count = high_count + 119end if
    values this step1high_count
  14. i ← 3

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step3i
  15. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.true.severities(3) >= min_severity
  16. visible_count ← 3

    14if (severities(i) >= min_severity) then15    visible_count = visible_count + 116end if
    values this step3visible_count
  17. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.false.severities(3) == 3
  18. i ← 4

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step4i
  19. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.true.severities(4) >= min_severity
  20. visible_count ← 4

    14if (severities(i) >= min_severity) then15    visible_count = visible_count + 116end if
    values this step4visible_count
  21. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.true.severities(4) == 3
  22. high_count ← 2

    17if (severities(i) == 3) then18    high_count = high_count + 119end if
    values this step2high_count
  23. print '(I0, 1X, I0, 1X, I0)', min_severity, visible_count, high_count

    20    end do21    print '(I0, 1X, I0, 1X, I0)', min_severity, visible_count, high_count22end program incident_queue_report_demo
    output1 4 2
    values this step1min_severity4visible_count2high_count
  1. severities ← [1, 3, 2, 3]

    9severities = [1, 3, 2, 3]10min_severity = 3
    values this step[1, 3, 2, 3]severities
  2. min_severity ← 3

    9severities = [1, 3, 2, 3]10min_severity = 311visible_count = 0
    values this step3min_severity
  3. visible_count ← 0

    10min_severity = 311visible_count = 012high_count = 0
    values this step0visible_count
  4. high_count ← 0

    11visible_count = 012high_count = 013do i = 1, 4
    values this step0high_count
  5. i ← 1

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step1i
  6. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.false.severities(1) >= min_severity
  7. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.false.severities(1) == 3
  8. i ← 2

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step2i
  9. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.true.severities(2) >= min_severity
  10. visible_count ← 1

    14if (severities(i) >= min_severity) then15    visible_count = visible_count + 116end if
    values this step1visible_count
  11. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.true.severities(2) == 3
  12. high_count ← 1

    17if (severities(i) == 3) then18    high_count = high_count + 119end if
    values this step1high_count
  13. i ← 3

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step3i
  14. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.false.severities(3) >= min_severity
  15. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.false.severities(3) == 3
  16. i ← 4

    12high_count = 013do i = 1, 414    if (severities(i) >= min_severity) then
    values this step4i
  17. if (severities(i) >= min_severity) then

    13do i = 1, 414    if (severities(i) >= min_severity) then15        visible_count = visible_count + 1
    values this step.true.severities(4) >= min_severity
  18. visible_count ← 2

    14if (severities(i) >= min_severity) then15    visible_count = visible_count + 116end if
    values this step2visible_count
  19. if (severities(i) == 3) then

    16end if17if (severities(i) == 3) then18    high_count = high_count + 1
    values this step.true.severities(4) == 3
  20. high_count ← 2

    17if (severities(i) == 3) then18    high_count = high_count + 119end if
    values this step2high_count
  21. print '(I0, 1X, I0, 1X, I0)', min_severity, visible_count, high_count

    20    end do21    print '(I0, 1X, I0, 1X, I0)', min_severity, visible_count, high_count22end program incident_queue_report_demo
    output3 2 2
    values this step3min_severity2visible_count2high_count
threshold count The first guard counts incidents at or above the selected severity.
independent count The high-severity counter is separate from the visible threshold.
loop report The final line reports the selector and both derived counts.