-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Describe the bug
After instantiating the first SparkMax in simulation (at least on Linux) CPU utilization of the java robot code process goes to ~112%. Also, a Notifier is created during the instantiation that appears to be unused -- the value displayed for it in the SimGUI timing window remains at 18446744 which is how Notifiers seem to be displayed if they are not started.
CPU utilization remains >100% when all the Java threads are paused in the debugger and the Pause button in the timing windows is clicked.
I have not seen evidence that instantiating a SparkMax on a RoboRio creates excessive CPU use. Also this did not occur with 2024 code and libs.
(Note: >100% CPU in linux top
means 1 core of a multi-core system is completely busy. I've now tried this on Windows and it reports CPU utilization as a fraction of the whole CPU. So although the CPU utilization on Windows is reported as "only" 33% that does mean that at least one core of my 4-core/8-thread cpu is busy.)
To Reproduce
Steps to reproduce the behavior:
Instantiate a SparkMax in while simulating robot code.
- Link to code (if applicable):
I see this happening in code from both repos linked in Memory issues in 2025 #64: https://bitbucket.org/sciborgs4061/robot-2025-beta/branches/ -- main branch and https://github.com/21-CameronM/ComBBAT21-2025-Beta. In the latter you need to comment out an unrelated line that uses a null pointer.
Expected behavior
CPU utilization remains about the same as what it was before instantiating the motor controller -- I would expect <10%.
Desktop (please complete the following information if applicable):
- OS: Linux, Ubuntu 22.04
- OS Language: English
- Project Information: WPILib Information:
Project Version: 2025.1.1-beta-2
VS Code Version: 1.94.2
WPILib Extension Version: 2025.1.1-beta-2
C++ Extension Version: 1.22.9
Java Extension Version: 1.36.2024092708
Java Debug Extension Version: 0.58.2024090204
Java Dependencies Extension Version 0.24.0
Java Version: 17
Java Location: /home/hauser/wpilib/2025/jdk
Vendor Libraries:
PathplannerLib (2025.0.0-beta-5)
CTRE-Phoenix (v6) (25.0.0-beta-3)
REVLib (2025.0.0-beta-3)
Studica (2025.1.1-beta-3)
WPILib-New-Commands (1.0.0)
photonlib (v2025.0.0-beta-5)
Additional context
Stepping through the code, the CPU utilization jumps when line 163 in SparkLowLevel.class is stepped over. You should be able to set a breakpoint on that line; step over it, and see the problem.