Skip to content

Commit

Permalink
Fix missing of linux memory metrics (#12713)
Browse files Browse the repository at this point in the history
* fix missing memory metric

* remove the print of type
  • Loading branch information
SpriCoder authored and HTHou committed Jun 26, 2024
1 parent 877c82a commit 887dafc
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ private void updateLinuxSystemMemInfo() {
result.append(line).append("\n");
}
}
String[] lines = result.toString().split("\n");
String[] lines = result.toString().trim().split("\n");
// if failed to get result
if (lines.length >= 2) {
String[] memParts = lines[1].trim().split("\\s+");
if (memParts.length == linuxMemoryTitles.length) {
if (memParts.length >= linuxMemoryTitles.length) {
usedMemory = Long.parseLong(memParts[2]) * 1024;
sharedMemory = Long.parseLong(memParts[4]) * 1024;
buffCacheMemory = Long.parseLong(memParts[5]) * 1024;
Expand Down

0 comments on commit 887dafc

Please sign in to comment.