Skip to content

fix(autoware_component_monitor): treat suffix-less RES as KiB - #12217

Merged
xmfcx merged 2 commits into
autowarefoundation:mainfrom
mikeedi:12215-fix-component-monitor-res-kib
Oct 15, 2026
Merged

xmfcx merged 2 commits into
autowarefoundation:mainfrom
mikeedi:12215-fix-component-monitor-res-kib

Conversation

@mikeedi

@mikeedi mikeedi commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Description

Fix autoware_component_monitor memory parsing for top RES values without a unit suffix.

top may print the RES column as a plain integer which is KiB, but the previous implementation interpreted suffix-less values as bytes, under-reporting RSS by ~1024x for small processes. This PR treats suffix-less RES values as KiB and adds a unit test for the parser.

Related links

Parent Issue:

#12215

How was this PR tested?

colcon test --packages-select autoware_component_monitor

Notes for reviewers

  • The change is limited to RES parsing (process_memory_bytes) and keeps suffix handling (k/m/g/...) intact.
  • Added test_top_memory_parser to cover both suffix-less and suffixed inputs.

Interface changes

None.

Effects on system behavior

process_memory_bytes will increase by ~1024x in cases where top prints RES without a suffix (previously under-reported).

@github-actions github-actions Bot added the component:system System design and integration. (auto-assigned) label Feb 28, 2026
@github-actions

Copy link
Copy Markdown

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@stale

stale Bot commented Apr 29, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity.

@stale stale Bot added the status:stale Inactive or outdated issues. (auto-assigned) label Apr 29, 2026
@xmfcx xmfcx added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Oct 15, 2026
@stale stale Bot removed the status:stale Inactive or outdated issues. (auto-assigned) label Oct 15, 2026
Signed-off-by: Mikhail Edukov <mike.edukov@gmail.com>
@xmfcx
xmfcx force-pushed the 12215-fix-component-monitor-res-kib branch from f684c14 to 3425931 Compare October 15, 2026 01:31
@xmfcx
xmfcx self-requested a review October 15, 2026 01:31
@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.58%. Comparing base (4fb338f) to head (94ee875).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...toware_component_monitor/src/top_memory_parser.hpp 83.33% 2 Missing ⚠️
...e_component_monitor/src/component_monitor_node.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12217      +/-   ##
==========================================
+ Coverage   37.56%   37.58%   +0.01%     
==========================================
  Files        2028     2029       +1     
  Lines      141955   141961       +6     
==========================================
+ Hits        53331    53349      +18     
+ Misses      88624    88612      -12     
Flag Coverage Δ *Carryforward flag
full-suite 37.57% <ø> (+<0.01%) ⬆️ Carriedforward from 3425931

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… false positive

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
@xmfcx

xmfcx commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

I restored the // NOLINTNEXTLINE(readability/casting) line above unit_map. cpplint reads std::function<std::uint64_t(double)> as a C-style cast, and this failed pre-commit-lite.

@xmfcx xmfcx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked top on Ubuntu 24.04: RES without a suffix is in KiB, the same as the rss value of ps. So the old bytes reading was wrong by a factor of 1024. The package builds, and its 29 tests pass locally. CI is green.

@xmfcx
xmfcx merged commit 7cdb582 into autowarefoundation:main Oct 15, 2026
30 checks passed
@github-project-automation github-project-automation Bot moved this from To Triage to Done in Software Working Group Oct 15, 2026
shmpwk pushed a commit to tier4/pilot_auto_system that referenced this pull request Oct 21, 2026
…refoundation/autoware_universe#12217)

* fix(autoware_component_monitor): treat suffix-less RES as KiB

Signed-off-by: Mikhail Edukov <mike.edukov@gmail.com>

* style(autoware_component_monitor): restore NOLINT for cpplint casting false positive

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>

---------

Signed-off-by: Mikhail Edukov <mike.edukov@gmail.com>
Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
Co-authored-by: Mete Fatih Cırıt <mfc@autoware.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:system System design and integration. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants