parent
377b0399a0
commit
0921850a79
@ -120,7 +120,7 @@ export default defineComponent({
|
|||||||
if (this.stats.length > 50) this.stats.shift();
|
if (this.stats.length > 50) this.stats.shift();
|
||||||
|
|
||||||
const cpuPolylinePoints = this.stats.map((s, i) => [this.viewBoxX - ((this.stats.length - 1) - i), (1 - s.cpu) * this.viewBoxY]);
|
const cpuPolylinePoints = this.stats.map((s, i) => [this.viewBoxX - ((this.stats.length - 1) - i), (1 - s.cpu) * this.viewBoxY]);
|
||||||
const memPolylinePoints = this.stats.map((s, i) => [this.viewBoxX - ((this.stats.length - 1) - i), (1 - (s.mem.used / this.meta.mem.total)) * this.viewBoxY]);
|
const memPolylinePoints = this.stats.map((s, i) => [this.viewBoxX - ((this.stats.length - 1) - i), (1 - (s.mem.active / this.meta.mem.total)) * this.viewBoxY]);
|
||||||
this.cpuPolylinePoints = cpuPolylinePoints.map(xy => `${xy[0]},${xy[1]}`).join(' ');
|
this.cpuPolylinePoints = cpuPolylinePoints.map(xy => `${xy[0]},${xy[1]}`).join(' ');
|
||||||
this.memPolylinePoints = memPolylinePoints.map(xy => `${xy[0]},${xy[1]}`).join(' ');
|
this.memPolylinePoints = memPolylinePoints.map(xy => `${xy[0]},${xy[1]}`).join(' ');
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ export default defineComponent({
|
|||||||
this.memHeadY = memPolylinePoints[memPolylinePoints.length - 1][1];
|
this.memHeadY = memPolylinePoints[memPolylinePoints.length - 1][1];
|
||||||
|
|
||||||
this.cpuP = (stats.cpu * 100).toFixed(0);
|
this.cpuP = (stats.cpu * 100).toFixed(0);
|
||||||
this.memP = (stats.mem.used / this.meta.mem.total * 100).toFixed(0);
|
this.memP = (stats.mem.active / this.meta.mem.total * 100).toFixed(0);
|
||||||
},
|
},
|
||||||
onStatsLog(statsLog) {
|
onStatsLog(statsLog) {
|
||||||
for (const stats of [...statsLog].reverse()) {
|
for (const stats of [...statsLog].reverse()) {
|
||||||
|
@ -45,10 +45,10 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onStats(stats) {
|
onStats(stats) {
|
||||||
this.usage = stats.mem.used / this.meta.mem.total;
|
this.usage = stats.mem.active / this.meta.mem.total;
|
||||||
this.total = this.meta.mem.total;
|
this.total = this.meta.mem.total;
|
||||||
this.used = stats.mem.used;
|
this.used = stats.mem.active;
|
||||||
this.free = this.meta.mem.total - stats.mem.used;
|
this.free = this.meta.mem.total - stats.mem.active;
|
||||||
},
|
},
|
||||||
bytes
|
bytes
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ export default function() {
|
|||||||
const stats = {
|
const stats = {
|
||||||
cpu: roundCpu(cpu),
|
cpu: roundCpu(cpu),
|
||||||
mem: {
|
mem: {
|
||||||
used: round(memStats.used),
|
used: round(memStats.used - memStats.buffers - memStats.cached),
|
||||||
active: round(memStats.active),
|
active: round(memStats.active),
|
||||||
},
|
},
|
||||||
net: {
|
net: {
|
||||||
|
Loading…
Reference in New Issue
Block a user