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 code orange loop cycle optimization settings #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def TEAM = 4099
def ROBOT_MAIN_CLASS = "com.team4099.robot2023.Main"
def includeDesktopSupport = true

final MAX_JAVA_HEAP_SIZE_MB = 100;

// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO's backing project EmbeddedTools.
deploy {
Expand All @@ -34,8 +36,27 @@ deploy {
// getTargetTypeClass is a shortcut to get the class type using a string

frcJava(getArtifactTypeClass('FRCJavaArtifact')) {
gcType = 'other'

jvmArgs.add("-XX:+UnlockExperimentalVMOptions")
jvmArgs.add("-Xmx" + MAX_JAVA_HEAP_SIZE_MB + "M")
jvmArgs.add("-Xms" + MAX_JAVA_HEAP_SIZE_MB + "M")
// Set the minimum heap size to the maximum heap size to avoid resizing
jvmArgs.add("-Djoml.fastmath=false")
// Disable fast math for JOML (it causes all sorts of weird issues)
jvmArgs.add("-ea") // Enable assertions
jvmArgs.add("-XX:+UseG1GC")
// Higher than the default 1ms, but allows for more consistent performance
jvmArgs.add("-XX:MaxGCPauseMillis=10")
jvmArgs.add("-XX:+AlwaysPreTouch")// Pre-touch memory pages used by the JVM during initialization
//jvmArgs.add("-XX:+ParallelRefProcEnabled") // Use multiple threads to clean up reference objects
// Causes GC to write to file system which can cause major latency if disk IO is high -- See https://www.evanjones.ca/jvm-mmap-pause.html
jvmArgs.add("-XX:+PerfDisableSharedMem")
//jvmArgs.add("-Xlog:gc*:/home/lvuser/gclogs/gc.log:time,uptime:filecount=5,filesize=1M")
// Log GC events to a file
}


// Static files artifact
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
files = project.fileTree('src/main/deploy')
Expand Down