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

Java SparkMax simulation uses 100+% CPU #65

Open
chauser opened this issue Dec 8, 2024 · 0 comments
Open

Java SparkMax simulation uses 100+% CPU #65

chauser opened this issue Dec 8, 2024 · 0 comments
Labels
bug Something isn't working REV Robotics

Comments

@chauser
Copy link

chauser commented Dec 8, 2024

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.

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.

@chauser chauser added the bug Something isn't working label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working REV Robotics
Projects
None yet
Development

No branches or pull requests

2 participants