Skip to content

Commit

Permalink
Fix #7067 (#7267)
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 authored and atsu1125 committed Aug 16, 2024
1 parent fcbc770 commit c0c2705
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/client/widgets/server-metric/cpu-mem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default defineComponent({
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 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.memPolylinePoints = memPolylinePoints.map(xy => `${xy[0]},${xy[1]}`).join(' ');
Expand All @@ -133,7 +133,7 @@ export default defineComponent({
this.memHeadY = memPolylinePoints[memPolylinePoints.length - 1][1];
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) {
for (const stats of [...statsLog].reverse()) {
Expand Down
6 changes: 3 additions & 3 deletions src/client/widgets/server-metric/mem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export default defineComponent({
},
methods: {
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.used = stats.mem.used;
this.free = this.meta.mem.total - stats.mem.used;
this.used = stats.mem.active;
this.free = this.meta.mem.total - stats.mem.active;
},
bytes
}
Expand Down
2 changes: 1 addition & 1 deletion src/daemons/server-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function() {
const stats = {
cpu: roundCpu(cpu),
mem: {
used: round(memStats.used),
used: round(memStats.used - memStats.buffers - memStats.cached),
active: round(memStats.active),
},
net: {
Expand Down

0 comments on commit c0c2705

Please sign in to comment.