mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 09:00:28 +08:00
RAM Graph
This commit is contained in:
parent
882fe3dad3
commit
435dbc17fc
@ -19,7 +19,7 @@ import java.util.List;
|
|||||||
* <p>
|
* <p>
|
||||||
* Contains following place-holders: tpsscatterday, tpsscatterweek, cpuscatterday, cpuscatterweek, averagetps(-week),
|
* Contains following place-holders: tpsscatterday, tpsscatterweek, cpuscatterday, cpuscatterweek, averagetps(-week),
|
||||||
* averagetpsday, averagecpuday, averagecpuweek, averagememoryday, averagememoryweek, averageentitiesday, averageentitiesweek,
|
* averagetpsday, averagecpuday, averagecpuweek, averagememoryday, averagememoryweek, averageentitiesday, averageentitiesweek,
|
||||||
* averagechunksday, averagechunkweek
|
* averagechunksday, averagechunkweek, ramscatterday, ramscatterweek
|
||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
* @since 3.5.2
|
* @since 3.5.2
|
||||||
@ -42,6 +42,8 @@ public class TPSPart extends RawData<TPSPart> {
|
|||||||
String tpsScatterWeek = TPSGraphCreator.buildScatterDataStringTPS(week, TimeAmount.WEEK.ms());
|
String tpsScatterWeek = TPSGraphCreator.buildScatterDataStringTPS(week, TimeAmount.WEEK.ms());
|
||||||
String cpuScatterDay = CPUGraphCreator.buildScatterDataString(day, TimeAmount.DAY.ms());
|
String cpuScatterDay = CPUGraphCreator.buildScatterDataString(day, TimeAmount.DAY.ms());
|
||||||
String cpuScatterWeek = CPUGraphCreator.buildScatterDataString(week, TimeAmount.WEEK.ms());
|
String cpuScatterWeek = CPUGraphCreator.buildScatterDataString(week, TimeAmount.WEEK.ms());
|
||||||
|
String ramScatterDay = CPUGraphCreator.buildScatterDataString(day, TimeAmount.DAY.ms());
|
||||||
|
String ramScatterWeek = CPUGraphCreator.buildScatterDataString(week, TimeAmount.WEEK.ms());
|
||||||
|
|
||||||
addValue("tpsscatterday", tpsScatterDay);
|
addValue("tpsscatterday", tpsScatterDay);
|
||||||
addValue("tpsscatterweek", tpsScatterWeek);
|
addValue("tpsscatterweek", tpsScatterWeek);
|
||||||
@ -49,6 +51,12 @@ public class TPSPart extends RawData<TPSPart> {
|
|||||||
addValue("cpuscatterday", cpuScatterDay);
|
addValue("cpuscatterday", cpuScatterDay);
|
||||||
addValue("cpuscatterweek", cpuScatterWeek);
|
addValue("cpuscatterweek", cpuScatterWeek);
|
||||||
|
|
||||||
|
addValue("ramscatterday", ramScatterDay);
|
||||||
|
addValue("ramscatterweek", ramScatterWeek);
|
||||||
|
|
||||||
|
Runtime runtime = Runtime.getRuntime();
|
||||||
|
addValue("maxram", (runtime.maxMemory() / (1024L * 1024L)));
|
||||||
|
|
||||||
double averageTPSWeek = MathUtils.averageDouble(week.stream().map(TPS::getTps));
|
double averageTPSWeek = MathUtils.averageDouble(week.stream().map(TPS::getTps));
|
||||||
double averageTPSDay = MathUtils.averageDouble(day.stream().map(TPS::getTps));
|
double averageTPSDay = MathUtils.averageDouble(day.stream().map(TPS::getTps));
|
||||||
|
|
||||||
|
@ -1,5 +1,19 @@
|
|||||||
package main.java.com.djrapitops.plan.ui.html.graphs;
|
package main.java.com.djrapitops.plan.ui.html.graphs;
|
||||||
|
|
||||||
|
import main.java.com.djrapitops.plan.data.TPS;
|
||||||
|
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||||
|
import main.java.com.djrapitops.plan.utilities.analysis.Point;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class RamGraphCreator {
|
public class RamGraphCreator {
|
||||||
// TODO
|
public static String buildScatterDataString(List<TPS> tpsData, long scale) {
|
||||||
|
long now = MiscUtils.getTime();
|
||||||
|
List<Point> points = tpsData.stream()
|
||||||
|
.filter(tps -> tps.getDate() >= now - scale)
|
||||||
|
.map(tps -> new Point(tps.getDate(), tps.getUsedMemory()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ScatterGraphCreator.scatterGraph(points, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box column">
|
<div class="box column">
|
||||||
<canvas id="cpu24h" width="1000" height="600" style="width: 95%;"></canvas>
|
<canvas id="cpu24h" width="1000" height="600" style="width: 95%;"></canvas>
|
||||||
<p>If CPU Graph displays '-1' CPU usage is not available for this platform.</p>
|
<p>If Graph displays '-1' usage is not available for this platform.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1395,6 +1395,7 @@
|
|||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: "CPU Usage",
|
label: "CPU Usage",
|
||||||
|
yAxisID: 'A',
|
||||||
fill: false,
|
fill: false,
|
||||||
lineTension: 0.1,
|
lineTension: 0.1,
|
||||||
borderColor: "#e0d264",
|
borderColor: "#e0d264",
|
||||||
@ -1413,6 +1414,27 @@
|
|||||||
pointHitRadius: 10,
|
pointHitRadius: 10,
|
||||||
spanGaps: false,
|
spanGaps: false,
|
||||||
data: %cpuscatterday%
|
data: %cpuscatterday%
|
||||||
|
}, {
|
||||||
|
label: "Memory Usage",
|
||||||
|
yAxisID: 'B',
|
||||||
|
fill: false,
|
||||||
|
lineTension: 0.1,
|
||||||
|
borderColor: "#7dcc24",
|
||||||
|
borderCapStyle: 'butt',
|
||||||
|
borderDash: [],
|
||||||
|
borderDashOffset: 0.0,
|
||||||
|
borderJoinStyle: 'miter',
|
||||||
|
pointBorderColor: "#7dcc24",
|
||||||
|
pointBackgroundColor: "#7dcc24",
|
||||||
|
pointBorderWidth: 1,
|
||||||
|
pointHoverRadius: 5,
|
||||||
|
pointHoverBackgroundColor: "#7dcc24",
|
||||||
|
pointHoverBorderColor: "#8fabc6",
|
||||||
|
pointHoverBorderWidth: 2,
|
||||||
|
pointRadius: 1,
|
||||||
|
pointHitRadius: 10,
|
||||||
|
spanGaps: false,
|
||||||
|
data: %ramscatterday%
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
var cpuChart = new Chart(ctxcpu, {
|
var cpuChart = new Chart(ctxcpu, {
|
||||||
@ -1431,6 +1453,7 @@
|
|||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
yAxes: [{
|
yAxes: [{
|
||||||
|
id: 'A',
|
||||||
type: 'linear',
|
type: 'linear',
|
||||||
position: 'left',
|
position: 'left',
|
||||||
ticks: {
|
ticks: {
|
||||||
@ -1439,7 +1462,19 @@
|
|||||||
},
|
},
|
||||||
scaleLabel: {
|
scaleLabel: {
|
||||||
display: true,
|
display: true,
|
||||||
labelString: 'CPU Usage'
|
labelString: 'CPU Usage (%)'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
id: 'B',
|
||||||
|
type: 'linear',
|
||||||
|
position: 'right',
|
||||||
|
ticks: {
|
||||||
|
suggestedMax: %maxram%,
|
||||||
|
suggestedMin: 0
|
||||||
|
},
|
||||||
|
scaleLabel: {
|
||||||
|
display: true,
|
||||||
|
labelString: 'Memory Usage (Mt)'
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
xAxes: [{
|
xAxes: [{
|
||||||
@ -1459,6 +1494,7 @@
|
|||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: "CPU Usage",
|
label: "CPU Usage",
|
||||||
|
yAxisID: 'A',
|
||||||
fill: false,
|
fill: false,
|
||||||
lineTension: 0.1,
|
lineTension: 0.1,
|
||||||
borderColor: "#e0d264",
|
borderColor: "#e0d264",
|
||||||
@ -1477,6 +1513,27 @@
|
|||||||
pointHitRadius: 10,
|
pointHitRadius: 10,
|
||||||
spanGaps: false,
|
spanGaps: false,
|
||||||
data: %cpuscatterweek%
|
data: %cpuscatterweek%
|
||||||
|
}, {
|
||||||
|
label: "Memory Usage",
|
||||||
|
yAxisID: 'B',
|
||||||
|
fill: false,
|
||||||
|
lineTension: 0.1,
|
||||||
|
borderColor: "#7dcc24",
|
||||||
|
borderCapStyle: 'butt',
|
||||||
|
borderDash: [],
|
||||||
|
borderDashOffset: 0.0,
|
||||||
|
borderJoinStyle: 'miter',
|
||||||
|
pointBorderColor: "#7dcc24",
|
||||||
|
pointBackgroundColor: "#7dcc24",
|
||||||
|
pointBorderWidth: 1,
|
||||||
|
pointHoverRadius: 5,
|
||||||
|
pointHoverBackgroundColor: "#7dcc24",
|
||||||
|
pointHoverBorderColor: "#8fabc6",
|
||||||
|
pointHoverBorderWidth: 2,
|
||||||
|
pointRadius: 1,
|
||||||
|
pointHitRadius: 10,
|
||||||
|
spanGaps: false,
|
||||||
|
data: %ramscatterday%
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
var cpuChart = new Chart(ctxcpu, {
|
var cpuChart = new Chart(ctxcpu, {
|
||||||
@ -1495,6 +1552,7 @@
|
|||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
yAxes: [{
|
yAxes: [{
|
||||||
|
id: 'A',
|
||||||
type: 'linear',
|
type: 'linear',
|
||||||
position: 'left',
|
position: 'left',
|
||||||
ticks: {
|
ticks: {
|
||||||
@ -1503,7 +1561,19 @@
|
|||||||
},
|
},
|
||||||
scaleLabel: {
|
scaleLabel: {
|
||||||
display: true,
|
display: true,
|
||||||
labelString: 'CPU Usage'
|
labelString: 'CPU Usage (%)'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
id: 'B',
|
||||||
|
type: 'linear',
|
||||||
|
position: 'right',
|
||||||
|
ticks: {
|
||||||
|
suggestedMax: %maxram%,
|
||||||
|
suggestedMin: 0
|
||||||
|
},
|
||||||
|
scaleLabel: {
|
||||||
|
display: true,
|
||||||
|
labelString: 'Memory Usage (Mt)'
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
xAxes: [{
|
xAxes: [{
|
||||||
|
Loading…
Reference in New Issue
Block a user