public List<FileSystemInfo> getFileSystems() { return getFileSystems(false); }
public NetworkStats getNetworkStats(String addressName, int port) { List<NetConnection> matches = getNetworkConnections(addressName, port); NetworkStats stats = new NetworkStats(matches.toArray(new NetConnection[matches.size()])); return stats; }
public List<ProcessInfo> getProcesses(String piq) { ProcessInfoQuery piql = new ProcessInfoQuery(getAllProcesses()); return piql.query(piq); }
/** * Returns the appropriate {@link SystemInfo} implementation based on the platform/operating system the JVM is * running on. * * @return a {@link NativeSystemInfo} implementation or a {@link JavaSystemInfo} if the native libraries are * {@link #isNativeSystemInfoAvailable() not available for the platform} or have been * {@link #disableNativeSystemInfo() disabled}. */ public static synchronized SystemInfo createSystemInfo() { if (cachedSystemInfo == null) { initialize(); // make sure we've loaded the native libraries, if appropriate SystemInfo nativePlatform = null; if (!isNativeSystemInfoDisabled() && isNativeSystemInfoAvailable()) { // we could use SIGAR here, but this should be enough if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) { nativePlatform = new WindowsNativeSystemInfo(); } else { // we either don't know what OS it is or we don't have a specific native subclass for it; // but we know we have a native library for it! so just create the generic NativePlatform to represent it. nativePlatform = new NativeSystemInfo(); } } if (nativePlatform == null) { nativePlatform = javaSystemInfo; } cachedSystemInfo = nativePlatform; } return cachedSystemInfo; }
public List<NetworkAdapterInfo> getAllNetworkAdapters() throws SystemInfoException { List<NetworkAdapterInfo> adapters = new ArrayList<NetworkAdapterInfo>(); try { String[] interfaceNames = sigar.getNetInterfaceList(); if (interfaceNames != null) { NetworkAdapterInfo.DisplayName displayName = NetworkAdapterInfo.DisplayName.FROM_NAME; // If Sigar can't get the adapter name it just starts naming the network adapters as eth0, eth1, etc. // This can be confusing on Windows, so we switch to their description // All references should be the same, as we are are only changing the displayName if (this.getOperatingSystemType() == OperatingSystemType.WINDOWS) { displayName = NetworkAdapterInfo.DisplayName.FROM_DESCRIPTION; } for (String interfaceName : interfaceNames) { if (interfaceName.indexOf(':') != -1) { continue; //filter out virtual IPs } adapters.add(new NetworkAdapterInfo(sigar.getNetInterfaceConfig(interfaceName), displayName)); } } } catch (Exception e) { throw new SystemInfoException(e); } return adapters; }
public List<ProcessInfo> getProcesses(String piq) { ProcessInfoQuery piql = new ProcessInfoQuery(getAllProcesses()); return piql.query(piq); }
/** * Returns the appropriate {@link SystemInfo} implementation based on the platform/operating system the JVM is * running on. * * @return a {@link NativeSystemInfo} implementation or a {@link JavaSystemInfo} if the native libraries are * {@link #isNativeSystemInfoAvailable() not available for the platform} or have been * {@link #disableNativeSystemInfo() disabled}. */ public static synchronized SystemInfo createSystemInfo() { if (cachedSystemInfo == null) { initialize(); // make sure we've loaded the native libraries, if appropriate SystemInfo nativePlatform = null; if (!isNativeSystemInfoDisabled() && isNativeSystemInfoAvailable()) { // we could use SIGAR here, but this should be enough if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) { nativePlatform = new WindowsNativeSystemInfo(); } else { // we either don't know what OS it is or we don't have a specific native subclass for it; // but we know we have a native library for it! so just create the generic NativePlatform to represent it. nativePlatform = new NativeSystemInfo(); } } if (nativePlatform == null) { nativePlatform = javaSystemInfo; } cachedSystemInfo = nativePlatform; } return cachedSystemInfo; }
public NetworkStats getNetworkStats(String addressName, int port) { List<NetConnection> matches = getNetworkConnections(addressName, port); NetworkStats stats = new NetworkStats(matches.toArray(new NetConnection[matches.size()])); return stats; }
public List<FileSystemInfo> getFileSystemsDeferredUsageInfo() { return getFileSystems(true); }