Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU and Memory usage monitoring script for ROS #2467

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

MishkaMN
Copy link
Contributor

@MishkaMN MishkaMN commented Nov 15, 2024

PR Details

Description

This PR supports efforts to create analysis scripts for control performance of CARMA. By running this before the carma starts, we are able to log the processes and see which one is taking more resources over time.

Example graph can be, which is not finalized and will be in the carma-analytics-fotda-repo.
image

Design document for this task is here: https://leidoscorpus.sharepoint.us/:w:/r/sites/STR/TODevelopmentLibrary/22-256%20CDA%20Design%20%26%20Architecture/Work-In-Progress/Task%207%20Architecture%20Improvement%20Implementation/CARMA%20Platform%20Controls%20Improvements/Identified%20Core%20Performance%20Metrics%20And%20Analysis%20Design%20for%20CARMA%20Platform%20Control.docx?d=w40615c2fbfb74d439215cf62c5e5c4ca&csf=1&web=1&e=NXYkMT
Before this, I tried looking to other methods, but this seemed most straightforward and without issue.
rqt_top is also deprecated in ROS2
ROS2_tracing kernel monitoring was really promising, but maybe it is due to foxy, we it was not possible to record the measurements.

Design task was done here and also mentions above other options I tried https://usdot-carma.atlassian.net/browse/ARC-207

Related GitHub Issue

NA

Related Jira Key

ARC-54

Motivation and Context

Control performance analysis script creation

How Has This Been Tested?

Tested on CDASim and on Live vehicle whether if it is gathering info fine.

Types of changes

  • Defect fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that cause existing functionality to change)

Checklist:

  • I have added any new packages to the sonar-scanner.properties file
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@MishkaMN MishkaMN self-assigned this Nov 15, 2024
@MishkaMN MishkaMN added the enhancement New feature or request label Nov 15, 2024
python3 monitor-ros-cpu.py

4. In a different terminal, start CARMA Platform:
./carma start all
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we have ../ for starting carma?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed



# Base path to save the CSV file
base_output_file = "cpu_usage_ros2_nodes.csv"
Copy link
Contributor

Choose a reason for hiding this comment

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

could you update the script so everything is saved in a folder? this way it would be easier to find/copy them after several runs.



# Function to create a unique filename by appending a number
def get_unique_filename(base_filename):
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we follow the file naming convention of ROS bags and include the date/time? This would make it easier to correlate the script output with the ROS bag file.

Copy link
Contributor

@john-chrosniak john-chrosniak left a comment

Choose a reason for hiding this comment

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

LGTM

@MishkaMN MishkaMN merged commit d6ce356 into develop Nov 18, 2024
4 checks passed
@MishkaMN MishkaMN deleted the feature/monitor-cpu-script branch November 18, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants