Skip to content

StatisticsManager.get_statistics returns negative idle_time when data+control time exceeds total #4892

Closed

Description

@Yicong-Huang

Bug Description

StatisticsManager.get_statistics() computes idle_time = total_execution_time - data_processing_time - control_processing_time with no clamp. When the data and control processing accumulators overshoot total_execution_time (e.g. instrumentation skew, or update_total_execution_time was called before some increase_* accumulators caught up), idle_time becomes a negative integer that propagates to the worker statistics protobuf.

File: amber/src/main/python/core/architecture/managers/statistics_manager.py:43-59

Reproduction

from core.architecture.managers.statistics_manager import StatisticsManager

mgr = StatisticsManager()
mgr.initialize_worker_start_time(1_000)
mgr.update_total_execution_time(1_100)  # 100 elapsed
mgr.increase_data_processing_time(80)
mgr.increase_control_processing_time(50)  # 80 + 50 = 130 > 100

print(mgr.get_statistics().idle_time)  # -30

Expected Behavior

Either floor idle_time at 0 or surface the inconsistency. A negative idle component is meaningless to downstream dashboards.

Affected Version

1.1.0-incubating, main

Activity

  1. added theissue type on May 4, 2026
  2. removed their assignment
    on May 4, 2026
  3. removed their assignment
    on May 4, 2026
  4. Ma77Ball commented on May 4, 2026

    @Ma77Ball
    Contributor

    /take

  5. Ma77Ball commented on May 4, 2026

    @Ma77Ball
    Contributor

    This issue is also found in StatisticsManager.scala. I'll open a separate pr and issue to work on fixing that one as well?

  6. Ma77Ball commented on May 4, 2026

    @Ma77Ball
    Contributor

    /untake

  7. Ma77Ball commented on May 4, 2026

    @Ma77Ball
    Contributor

    /take

  8. Yicong-Huang commented on May 4, 2026

    @Yicong-Huang
    ContributorAuthor

    This issue is also found in StatisticsManager.scala. I'll open a separate pr and issue to work on fixing that one as well?

    Sure! Please feel free to do so! There are many small issues here and there in the repo. Let's patch them whenever we discover some.

  9. added a commit that references this issue on May 5, 2026
    056e39d
  10. added a commit that references this issue on Jun 22, 2026
    0ee12c1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions