
net.rdrei.android.buildtimetracker.reporters.SysInfo.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-plugin Show documentation
Show all versions of gradle-plugin Show documentation
Gradle plugin which tracks your build times.
The newest version!
package net.rdrei.android.buildtimetracker.reporters;
public class SysInfo {
String getOSIdentifier() {
["os.name", "os.version", "os.arch"].collect { System.getProperty(it) }.join(" ")
}
long getMaxMemory() {
MemoryUtil.physicalMemoryAvailable
}
String getCPUIdentifier() {
def os = System.getProperty("os.name")
if (os.equalsIgnoreCase("mac os x")) {
def proc = ["sysctl", "-n", "machdep.cpu.brand_string"].execute()
proc.waitFor()
if (proc.exitValue() == 0) {
return proc.in.text.trim()
}
} else if (os.equalsIgnoreCase("linux")) {
def osName = ""
new File("/proc/cpuinfo").eachLine {
if (!osName.isEmpty()) return
if (it.startsWith("model name")) {
osName = it.split(": ")[1]
}
}
return osName
}
return ""
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy