Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
package org.eclipse.tea.core.internal.stats;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.lang.management.ManagementFactory;
Expand All @@ -19,13 +21,13 @@
import java.net.HttpURLConnection;
import java.net.URI;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import jakarta.inject.Named;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.di.extensions.Service;
Expand All @@ -43,6 +45,8 @@
import com.google.common.base.Strings;
import com.google.gson.GsonBuilder;

import jakarta.inject.Named;

/**
* Handles the actual posting of statistics to a remote server (if configured).
*/
Expand Down Expand Up @@ -145,16 +149,25 @@ private SysDTO gatherSystemInfo() {
dto.loadavg = osb.getSystemLoadAverage();

// infos that are not on the public API
dto.totalMem = tryGet(osb, "getTotalPhysicalMemorySize", 0L);
dto.freeMem = tryGet(osb, "getFreePhysicalMemorySize", 0L);
dto.totalMem = tryGet(osb, "getTotalMemorySize", 0L);
dto.freeMem = tryGet(osb, "getFreeMemorySize", 0L);

dto.totalSwap = tryGet(osb, "getTotalSwapSpaceSize", 0L);
dto.freeSwap = tryGet(osb, "getFreeSwapSpaceSize", 0L);

dto.processLoad = tryGet(osb, "getProcessCpuLoad", 0.0d);
dto.systemLoad = tryGet(osb, "getSystemCpuLoad", 0.0d);
dto.systemLoad = tryGet(osb, "getCpuLoad", 0.0d);

dto.processCpuTime = tryGet(osb, "getProcessCpuTime", 0l);

try {
String javaVersion = System.getProperty("java.version");
if (javaVersion != null) {
dto.javaVersion = javaVersion;
}
} catch (SecurityException e) {

}
return dto;
}

Expand Down Expand Up @@ -227,6 +240,7 @@ private static class SysDTO {
public long totalMem = 0;
public double loadavg = 0;
public int processors = 0;
public String javaVersion = "<Unkown>";
}

@SuppressWarnings("unused")
Expand Down
Loading