Skip to content

Commit

Permalink
ZOOKEEPER-4792: Use jvm as the prefix for the memory env log.
Browse files Browse the repository at this point in the history
Reviewers: maoling
Author: horizonzy
Closes apache#2112 from horizonzy/tune-the-jvm-env-log
  • Loading branch information
horizonzy authored Feb 7, 2024
1 parent 71b7515 commit 07f5cc6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public static List<Entry> list() {
// Get memory information.
Runtime runtime = Runtime.getRuntime();
int mb = 1024 * 1024;
put(l, "os.memory.free", runtime.freeMemory() / mb + "MB");
put(l, "os.memory.max", runtime.maxMemory() / mb + "MB");
put(l, "os.memory.total", runtime.totalMemory() / mb + "MB");
put(l, "jvm.memory.free", runtime.freeMemory() / mb + "MB");
put(l, "jvm.memory.max", runtime.maxMemory() / mb + "MB");
put(l, "jvm.memory.total", runtime.totalMemory() / mb + "MB");

return l;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void testDump() throws IOException, InterruptedException {

@Test
public void testEnvironment() throws IOException, InterruptedException {
testCommand("environment", new Field("zookeeper.version", String.class), new Field("host.name", String.class), new Field("java.version", String.class), new Field("java.vendor", String.class), new Field("java.home", String.class), new Field("java.class.path", String.class), new Field("java.library.path", String.class), new Field("java.io.tmpdir", String.class), new Field("java.compiler", String.class), new Field("os.name", String.class), new Field("os.arch", String.class), new Field("os.version", String.class), new Field("user.name", String.class), new Field("user.home", String.class), new Field("user.dir", String.class), new Field("os.memory.free", String.class), new Field("os.memory.max", String.class), new Field("os.memory.total", String.class));
testCommand("environment", new Field("zookeeper.version", String.class), new Field("host.name", String.class), new Field("java.version", String.class), new Field("java.vendor", String.class), new Field("java.home", String.class), new Field("java.class.path", String.class), new Field("java.library.path", String.class), new Field("java.io.tmpdir", String.class), new Field("java.compiler", String.class), new Field("os.name", String.class), new Field("os.arch", String.class), new Field("os.version", String.class), new Field("user.name", String.class), new Field("user.home", String.class), new Field("user.dir", String.class), new Field("jvm.memory.free", String.class), new Field("jvm.memory.max", String.class), new Field("jvm.memory.total", String.class));
}

@Test
Expand Down

0 comments on commit 07f5cc6

Please sign in to comment.