Skip to content

Commit

Permalink
Print out more machine info
Browse files Browse the repository at this point in the history
Signed-off-by: renfeiw <[email protected]>
  • Loading branch information
renfeiw committed Feb 27, 2023
1 parent f01000e commit 5d83f85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/org/openj9/envInfo/CmdExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public String execute(String[] commands) {
rt = sb.toString();
proc.waitFor();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
return "Command could not be executed";
}
return rt;
Expand Down
12 changes: 10 additions & 2 deletions src/org/openj9/envInfo/MachineInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ public class MachineInfo {

// Software
public static final String[] SYS_OS_CMD = new String[] {"uname", "-s"};
public static final String[] KERNEL_VERSION_CMD = new String[] {"uname", "-r"};
public static final String[] GCC_VERSION_CMD = new String[] {"gcc", "-dumpversion"};

public static final String[] XLC_VERSION_CMD = new String[] {"bash", "-c", "xlC -qversion | grep 'Version' "};
public static final String[] GDB_VERSION_CMD = new String[] {"bash", "-c", "gdb --version | head -1"}; // debugger on Linux
public static final String[] LLDB_VERSION_CMD = new String[] {"lldb", "--version"}; // debugger on Darwin/Mac
Expand Down Expand Up @@ -81,6 +79,7 @@ public void checkInfo() {
getRuntimeInfo();
getPhysicalMemoryInfo();
getSpaceInfo();
getOtherInfo();
validateInfo();
}

Expand Down Expand Up @@ -220,4 +219,13 @@ private void getPhysicalMemoryInfo() {
putInfo(new Info("Total Physical Memory Size", new String[] {"osBean.getTotalPhysicalMemorySize()"}, String.valueOf(osBean.getTotalPhysicalMemorySize()), null));
putInfo(new Info("Free Physical Memory Size", new String[] {"osBean.getFreePhysicalMemorySize()"}, String.valueOf(osBean.getFreePhysicalMemorySize()), null));
}

private void getOtherInfo() {
CmdExecutor ce = CmdExecutor.getInstance();
putInfo(new Info("gcc version", GCC_VERSION_CMD, ce.execute(GCC_VERSION_CMD), null));
putInfo(new Info("xlc version", XLC_VERSION_CMD, ce.execute(XLC_VERSION_CMD), null));
putInfo(new Info("gdb version", GDB_VERSION_CMD, ce.execute(GDB_VERSION_CMD), null));
putInfo(new Info("lldb version", LLDB_VERSION_CMD, ce.execute(LLDB_VERSION_CMD), null));
putInfo(new Info("gclibc version", GCLIBC_VERSION_CMD, ce.execute(GCLIBC_VERSION_CMD), null));
}
}

0 comments on commit 5d83f85

Please sign in to comment.