Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](fe-ui) support read hardware info from aarch64 MacOS (#23708) #33079

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fe/fe-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,12 @@ under the License.
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.5.0</version>
<version>5.13.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.5.0</version>
<version>5.13.0</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import oshi.software.os.OSFileStore;
import oshi.software.os.OSProcess;
import oshi.software.os.OperatingSystem;
import oshi.software.os.OperatingSystem.ProcessSorting;
import oshi.util.FormatUtil;
import oshi.util.Util;

Expand Down Expand Up @@ -101,8 +102,8 @@ private List<String> getProcessor(CentralProcessor processor) {
processorInfo.add(" " + processor.getPhysicalProcessorCount() + " physical CPU core(s)");
processorInfo.add(" " + processor.getLogicalProcessorCount() + " logical CPU(s)");

processorInfo.add("Identifier:&nbsp;&nbsp; " + processor.getIdentifier());
processorInfo.add("ProcessorID:&nbsp;&nbsp; " + processor.getProcessorID());
processorInfo.add("Identifier:&nbsp;&nbsp; " + processor.getProcessorIdentifier().getIdentifier());
processorInfo.add("ProcessorID:&nbsp;&nbsp; " + processor.getProcessorIdentifier().getProcessorID());
processorInfo.add("Context Switches/Interrupts:&nbsp;&nbsp; " + processor.getContextSwitches()
+ " / " + processor.getInterrupts() + "<br>");

Expand Down Expand Up @@ -150,7 +151,7 @@ private List<String> getProcessor(CentralProcessor processor) {
procCpu.append(String.format(" %.1f%%", avg * 100));
}
processorInfo.add(procCpu.toString());
long freq = processor.getVendorFreq();
long freq = processor.getProcessorIdentifier().getVendorFreq();
if (freq > 0) {
processorInfo.add("Vendor Frequency:&nbsp;&nbsp; " + FormatUtil.formatHertz(freq));
}
Expand Down Expand Up @@ -187,7 +188,8 @@ private List<String> getProcesses(OperatingSystem os, GlobalMemory memory) {
processInfo.add("Processes:&nbsp;&nbsp; " + os.getProcessCount()
+ ", Threads:&nbsp;&nbsp; " + os.getThreadCount());
// Sort by highest CPU
List<OSProcess> procs = Arrays.asList(os.getProcesses(5, OperatingSystem.ProcessSort.CPU));

List<OSProcess> procs = os.getProcesses((osProcess) -> true, ProcessSorting.CPU_DESC, 5);

processInfo.add("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PID %CPU %MEM VSZ RSS Name");
for (int i = 0; i < procs.size() && i < 5; i++) {
Expand All @@ -201,7 +203,7 @@ private List<String> getProcesses(OperatingSystem os, GlobalMemory memory) {
return processInfo;
}

private List<String> getDisks(HWDiskStore[] diskStores) {
private List<String> getDisks(List<HWDiskStore> diskStores) {
List<String> diskInfo = new ArrayList<>();
diskInfo.add("Disks:&nbsp;&nbsp;");
for (HWDiskStore disk : diskStores) {
Expand All @@ -213,7 +215,7 @@ private List<String> getDisks(HWDiskStore[] diskStores) {
readwrite ? disk.getReads() : "?", readwrite ? FormatUtil.formatBytes(disk.getReadBytes()) : "?",
readwrite ? disk.getWrites() : "?", readwrite ? FormatUtil.formatBytes(disk.getWriteBytes()) : "?",
readwrite ? disk.getTransferTime() : "?"));
HWPartition[] partitions = disk.getPartitions();
List<HWPartition> partitions = disk.getPartitions();
for (HWPartition part : partitions) {
diskInfo.add(String.format("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
+ " |-- %s: %s (%s) Maj:Min=%d:%d, size: %s%s", part.getIdentification(),
Expand All @@ -232,13 +234,13 @@ private List<String> getFileSystem(FileSystem fileSystem) {
fsInfo.add(String.format("&nbsp;&nbsp;&nbsp;&nbsp;File Descriptors: %d/%d", fileSystem.getOpenFileDescriptors(),
fileSystem.getMaxFileDescriptors()));

OSFileStore[] fsArray = fileSystem.getFileStores();
for (OSFileStore fs : fsArray) {
List<OSFileStore> fsList = fileSystem.getFileStores();
for (OSFileStore fs : fsList) {
long usable = fs.getUsableSpace();
long total = fs.getTotalSpace();
fsInfo.add(String.format("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
+ "%s (%s) [%s] %s of %s free (%.1f%%), %s of %s files free (%.1f%%) is %s "
+ (fs.getLogicalVolume() != null && fs.getLogicalVolume().length() > 0 ? "[%s]" : "%s")
+ (fs.getLogicalVolume() != null && !fs.getLogicalVolume().isEmpty() ? "[%s]" : "%s")
+ " and is mounted at %s",
fs.getName(), fs.getDescription().isEmpty() ? "file system" : fs.getDescription(), fs.getType(),
FormatUtil.formatBytes(usable), FormatUtil.formatBytes(fs.getTotalSpace()), 100d * usable / total,
Expand All @@ -249,7 +251,7 @@ private List<String> getFileSystem(FileSystem fileSystem) {
return fsInfo;
}

private List<String> getNetworkInterfaces(NetworkIF[] networkIFs) {
private List<String> getNetworkInterfaces(List<NetworkIF> networkIFs) {
List<String> getNetwork = new ArrayList<>();
getNetwork.add("Network interfaces:&nbsp;&nbsp;");
for (NetworkIF net : networkIFs) {
Expand Down
2 changes: 1 addition & 1 deletion fe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ under the License.
<validation-api.version>1.1.0.Final</validation-api.version>
<zjsonpatch.version>0.2.3</zjsonpatch.version>
<kafka-clients.version>3.4.0</kafka-clients.version>
<oshi-core.version>4.0.0</oshi-core.version>
<oshi-core.version>6.4.5</oshi-core.version>
<xnio-nio.version>3.8.8.Final</xnio-nio.version>
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
<javax.activation.version>1.2.0</javax.activation.version>
Expand Down
Loading