浏览代码

add watts column

master
Slixe 6 个月前
父节点
当前提交
42a32e9253
共有 6 个文件被更改,包括 39 次插入7 次删除
  1. +4
    -0
      dero-benchmark-vue/src/views/Index.vue
  2. +3
    -0
      dero-benchmark-vue/src/views/Submit.vue
  3. +4
    -0
      dero-benchmark-vue/src/views/auth/UBenchmarks.vue
  4. +17
    -3
      src/main/java/fr/slixe/benchmarks/Benchmark.java
  5. +4
    -3
      src/main/java/fr/slixe/benchmarks/http/controller/MainController.groovy
  6. +7
    -1
      src/main/java/fr/slixe/benchmarks/serialization/BenchmarkAdapter.java

+ 4
- 0
dero-benchmark-vue/src/views/Index.vue 查看文件

@@ -41,6 +41,10 @@ export default {
text: "Hashrate (h/s)",
value: "hashrate"
},
{
text: "Watts (w)",
value: "watts"
},
{
text: "Miner",
value: "minerVersion"


+ 3
- 0
dero-benchmark-vue/src/views/Submit.vue 查看文件

@@ -9,6 +9,7 @@
<v-text-field v-model="model" autocomplete="model" label="Model" required></v-text-field>
<v-text-field v-model="memory" autocomplete="memory" label="Memory" required></v-text-field>
<v-text-field v-model="hashrate" autocomplete="hashrate" label="Hashrate" required></v-text-field>
<v-text-field v-model="watts" autocomplete="watts" label="Watts" required></v-text-field>
<v-text-field v-model="miner" autocomplete="miner" label="Miner" required></v-text-field>
<v-text-field v-model="user" autocomplete="user" label="User" class="text-field" equired></v-text-field>
<v-btn @click="submit()" color="blue">Submit</v-btn>
@@ -27,6 +28,7 @@ export default {
model: "",
memory: "",
hashrate: "",
watts: 0,
miner: "",
user: "",
alertType: "error",
@@ -46,6 +48,7 @@ export default {
model: this.model,
memory: this.memory,
hashrate: this.hashrate,
watts: this.watts,
minerVersion: this.miner,
owner: this.user
})


+ 4
- 0
dero-benchmark-vue/src/views/auth/UBenchmarks.vue 查看文件

@@ -46,6 +46,10 @@ export default {
text: "Hashrate (h/s)",
value: "hashrate"
},
{
text: "Watts (w)",
value: "watts"
},
{
text: "Miner",
value: "minerVersion"


+ 17
- 3
src/main/java/fr/slixe/benchmarks/Benchmark.java 查看文件

@@ -7,17 +7,24 @@ public class Benchmark {
private String model; //Ryzen 5 3600X
private String memory;
private long hashrate; //550h/s
private int watts;
private String minerVersion; //XMRig 5.9.0
private String owner; //Owner
private long timestamp; //Submitted on 08/03/2020
public Benchmark(int id, Vendor vendor, String model, String memory, long hashrate, String minerVersion, String owner, long timestamp)
{
this(id, vendor, model, memory, hashrate, 0, minerVersion, owner, timestamp);
}

public Benchmark(int id, Vendor vendor, String model, String memory, long hashrate, int watts, String minerVersion, String owner, long timestamp)
{
this.id = id;
this.vendor = vendor;
this.model = model;
this.memory = memory;
this.hashrate = hashrate;
this.watts = watts;
this.minerVersion = minerVersion;
this.owner = owner;
this.timestamp = timestamp;
@@ -52,6 +59,11 @@ public class Benchmark {
{
return hashrate;
}

public int getWatts()
{
return watts;
}
public String getMinerVersion()
{
@@ -71,12 +83,14 @@ public class Benchmark {
@Override
public String toString()
{
return String.format("Benchmark[vendor=%s, model=%s, memory=%s, hashrate=%d, owner=%s, timestamp=%d]", vendor.name(), model, memory, hashrate, owner, timestamp);
return String.format("Benchmark[vendor=%s, model=%s, memory=%s, hashrate=%d, watts=%d, owner=%s, timestamp=%d]", vendor.name(), model, memory, hashrate, watts, owner, timestamp);
}

public static enum Vendor {
AMD,
NVIDIA,
INTEL
INTEL,
ARM,
OTHER
}
}

+ 4
- 3
src/main/java/fr/slixe/benchmarks/http/controller/MainController.groovy 查看文件

@@ -45,16 +45,17 @@ public class MainController extends Controller {
* @param Vendor vendor (AMD/INTEL/NVIDIA)
* @param String model (Ryzen 5 3600X)
* @param long hashrate (in h/s)
* @param watts 75
* @param String minerVersion (XMRig 5.9.0)
* @param String owner (Slixe)
*/
@JsonBody
@RequestParams(required = ["vendor", "model", "memory", "hashrate", "minerVersion", "owner"])
def submit(Vendor vendor, String model, String memory, long hashrate, String minerVersion, String owner)
@RequestParams(required = ["vendor", "model", "memory", "hashrate", "watts", "minerVersion", "owner"])
def submit(Vendor vendor, String model, String memory, long hashrate, int watts, String minerVersion, String owner)
{
log.debug("A new benchmark has been submitted!")
Benchmark benchmark = new Benchmark(benchmarkService.lastUnconfirmedBenchId(), vendor, model, memory, hashrate, minerVersion, owner, System.currentTimeMillis())
Benchmark benchmark = new Benchmark(benchmarkService.lastUnconfirmedBenchId(), vendor, model, memory, hashrate, watts, minerVersion, owner, System.currentTimeMillis())
benchmarkService.addUnconfirmedBenchmarks(benchmark)

[


+ 7
- 1
src/main/java/fr/slixe/benchmarks/serialization/BenchmarkAdapter.java 查看文件

@@ -25,6 +25,7 @@ public class BenchmarkAdapter implements JsonSerializer<Benchmark>, JsonDeserial
json.addProperty("model", src.getModel());
json.addProperty("memory", src.getMemory());
json.addProperty("hashrate", src.getHashrate());
json.addProperty("watts", src.getWatts());
json.addProperty("minerVersion", src.getMinerVersion());
json.addProperty("owner", src.getOwner());
json.addProperty("timestamp", src.getTimestamp());
@@ -46,6 +47,11 @@ public class BenchmarkAdapter implements JsonSerializer<Benchmark>, JsonDeserial
String owner = json.get("owner").getAsString();
long timestamp = json.get("timestamp").getAsLong();

return new Benchmark(id, vendor, model, memory, hashrate, minerVersion, owner, timestamp);
int watts = 0;
if (json.has("watts")) {
watts = json.get("watts").getAsInt();
}

return new Benchmark(id, vendor, model, memory, hashrate, watts, minerVersion, owner, timestamp);
}
}

正在加载...
取消
保存