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

Add docs to monitor-ros-cpu.py #2473

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions engineering_tools/monitor-ros-cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@
import argparse
from datetime import datetime

"""
CARMA Platform CPU Monitor Script
Requirements:
- Python 3.6 or higher
- psutil package (install with: pip3 install psutil)
Usage:
1. Open a new terminal before starting CARMA Platform
2. Navigate to the directory containing this script:
cd /path/to/script/
3. Run this script:
python3 monitor-ros-cpu.py
4. In a different terminal, start CARMA Platform:
carma start all
5. The script will automatically monitor and log CPU/memory usage
of all ROS2 nodes and related processes during CARMA operation
6. To stop monitoring:
- Press Ctrl+C ONCE in the monitoring terminal
- The CSV output file will be saved in the logs directory following ROS bag naming convention:
'logs/cpu_usage_ros2_nodes_YYYY_MM_DD-HH_MM_SS.csv'
Output:
- CSV file containing timestamp, process info, CPU and memory usage
- Data can be used to analyze CARMA Platform resource utilization
"""

# Define ROS-related keywords to filter processes
ROS_KEYWORDS = {
"ros",
Expand Down
Loading