Merge branch 'CPU-Reduction' into 'master'
Use Lombok annot's to minimize code. See merge request sheepitrenderfarm/client!252
This commit is contained in:
@@ -659,7 +659,7 @@ import okhttp3.HttpUrl;
|
||||
StringBuilder logHeader = new StringBuilder()
|
||||
.append("====================================================================================================\n")
|
||||
.append(String.format("%s / %s / %s / SheepIt v%s\n", conf.getLogin(), conf.getHostname(), OS.getOS().name(), Configuration.jarVersion))
|
||||
.append(String.format("%s x%d %.1f GB RAM\n", cpu.name(), conf.getNbCores(), conf.getMaxAllowedMemory() / 1024.0 / 1024.0));
|
||||
.append(String.format("%s x%d %.1f GB RAM\n", cpu.getName(), conf.getNbCores(), conf.getMaxAllowedMemory() / 1024.0 / 1024.0));
|
||||
|
||||
if (conf.getComputeMethod() == Configuration.ComputeType.GPU || conf.getComputeMethod() == Configuration.ComputeType.CPU_GPU) {
|
||||
logHeader.append(String.format("%s %s %.1f GB VRAM\n", conf.getGPUDevice().getId(), conf.getGPUDevice().getModel(),
|
||||
|
||||
@@ -203,14 +203,14 @@ public class Server extends Thread {
|
||||
FormBody formBody = new FormBody.Builder()
|
||||
.add("login", user_config.getLogin())
|
||||
.add("password", user_config.getPassword())
|
||||
.add("cpu_family", os.getCPU().family())
|
||||
.add("cpu_model", os.getCPU().model())
|
||||
.add("cpu_model_name", os.getCPU().name())
|
||||
.add("cpu_family", os.getCPU().getFamily())
|
||||
.add("cpu_model", os.getCPU().getModel())
|
||||
.add("cpu_model_name", os.getCPU().getName())
|
||||
.add("cpu_cores", String.valueOf(user_config.getNbCores() == -1 ? os.getCPU().cores() : Math.max(CPU.MIN_CORES, user_config.getNbCores())))
|
||||
.add("os", os.name())
|
||||
.add("os_version", os.getVersion())
|
||||
.add("ram", String.valueOf(os.getTotalMemory()))
|
||||
.add("bits", os.getCPU().arch())
|
||||
.add("bits", os.getCPU().getArch())
|
||||
.add("version", Configuration.jarVersion)
|
||||
.add("hostname", user_config.getHostname())
|
||||
.add("ui", client.getGui().getClass().getSimpleName())
|
||||
|
||||
@@ -22,12 +22,14 @@ package com.sheepit.client.hardware.cpu;
|
||||
import com.sheepit.client.Log;
|
||||
import com.sheepit.client.os.OS;
|
||||
import com.sheepit.client.os.Windows;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class CPU {
|
||||
@Getter @Setter public class CPU {
|
||||
public static final int MIN_CORES = Runtime.getRuntime().availableProcessors() > 1 ? 2 : 1;
|
||||
private String name;
|
||||
private String model;
|
||||
@@ -43,22 +45,6 @@ public class CPU {
|
||||
this.generateArch();
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String model() {
|
||||
return this.model;
|
||||
}
|
||||
|
||||
public String family() {
|
||||
return this.family;
|
||||
}
|
||||
|
||||
public String arch() {
|
||||
return this.arch;
|
||||
}
|
||||
|
||||
public int cores() {
|
||||
// If logicalCores is -1, then haven't run the core-checking script yet
|
||||
// Only want to run it once since cores is called multiple times
|
||||
@@ -113,22 +99,6 @@ public class CPU {
|
||||
return logicalCores;
|
||||
}
|
||||
|
||||
public void setName(String name_) {
|
||||
this.name = name_;
|
||||
}
|
||||
|
||||
public void setModel(String model_) {
|
||||
this.model = model_;
|
||||
}
|
||||
|
||||
public void setFamily(String family_) {
|
||||
this.family = family_;
|
||||
}
|
||||
|
||||
public void setArch(String arch_) {
|
||||
this.arch = arch_;
|
||||
}
|
||||
|
||||
public void generateArch() {
|
||||
String arch = System.getProperty("os.arch").toLowerCase();
|
||||
switch (arch) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class OS {
|
||||
|
||||
public abstract String name();
|
||||
|
||||
public boolean isSupported() { return "64bit".equals(getCPU().arch()); }
|
||||
public boolean isSupported() { return "64bit".equals(getCPU().getArch()); }
|
||||
|
||||
/** Get the full version of the os.
|
||||
* For example windows, should give "windows 8.1"
|
||||
|
||||
Reference in New Issue
Block a user