diff --git a/src/main/java/io/antmedia/rest/RestServiceBase.java b/src/main/java/io/antmedia/rest/RestServiceBase.java index fe0f74e6e..ef1e7b5f3 100755 --- a/src/main/java/io/antmedia/rest/RestServiceBase.java +++ b/src/main/java/io/antmedia/rest/RestServiceBase.java @@ -1857,7 +1857,7 @@ public static Version getSoftwareVersion() { version.setVersionType(isEnterprise() ? RestServiceBase.ENTERPRISE_EDITION : RestServiceBase.COMMUNITY_EDITION); - logger.info("Version Name {} Version Type {}", version.getVersionName(), version.getVersionType()); + logger.debug("Version Name {} Version Type {}", version.getVersionName(), version.getVersionType()); return version; } diff --git a/src/main/java/io/antmedia/statistic/GPUUtils.java b/src/main/java/io/antmedia/statistic/GPUUtils.java index 0d5072c58..91b48539f 100644 --- a/src/main/java/io/antmedia/statistic/GPUUtils.java +++ b/src/main/java/io/antmedia/statistic/GPUUtils.java @@ -5,7 +5,8 @@ import static org.bytedeco.cuda.global.nvml.nvmlDeviceGetHandleByIndex_v2; import static org.bytedeco.cuda.global.nvml.nvmlDeviceGetMemoryInfo; import static org.bytedeco.cuda.global.nvml.nvmlDeviceGetName; -import static org.bytedeco.cuda.global.nvml.nvmlDeviceGetUtilizationRates; +import static org.bytedeco.cuda.global.nvml.*; + import static org.bytedeco.cuda.global.nvml.nvmlInit_v2; import org.bytedeco.cuda.global.nvml; @@ -123,6 +124,7 @@ private nvmlUtilization_t getUtilization(int deviceNo) { } return null; } + public MemoryStatus getMemoryStatus(int deviceNo) { @@ -136,6 +138,46 @@ public MemoryStatus getMemoryStatus(int deviceNo) { return null; } + /** + * Get the encoder utilization of the device + * @param deviceNo + * @return encoder utilization by percentage + */ + public int getEncoderUtilization(int deviceNo) { + nvmlDevice_st device = null; + if ((device = getDevice(deviceNo)) != null) + { + int[] encoderUtilization = new int[1]; + int[] samplingPeriod = new int[1]; + + if (nvmlDeviceGetEncoderUtilization(device, encoderUtilization, samplingPeriod) == NVML_SUCCESS) { + return encoderUtilization[0]; + } + } + return -1; + } + + /** + * Get the decoder utilization of the device + * @param deviceNo + * @return decoder utilization by percentage + */ + public int getDecoderUtilization(int deviceNo) { + nvmlDevice_st device = null; + if ((device = getDevice(deviceNo)) != null) + { + int[] decoderUtilization = new int[1]; + int[] samplingPeriod = new int[1]; + + if (nvmlDeviceGetDecoderUtilization(device, decoderUtilization, samplingPeriod) == NVML_SUCCESS) { + return decoderUtilization[0]; + } + } + return -1; + } + + + public String getDeviceName(int deviceIndex) { nvmlDevice_st device = null; if ((device = getDevice(deviceIndex)) != null) { diff --git a/src/test/java/io/antmedia/integration/ConsoleAppRestServiceTest.java b/src/test/java/io/antmedia/integration/ConsoleAppRestServiceTest.java index 02a53c771..ccc632c20 100644 --- a/src/test/java/io/antmedia/integration/ConsoleAppRestServiceTest.java +++ b/src/test/java/io/antmedia/integration/ConsoleAppRestServiceTest.java @@ -399,6 +399,10 @@ public String getStreamAppWar(String installLocation) boolean threadStarted = false; boolean breakThread = false; + /** + * Bug fix test + * https://github.com/ant-media/Ant-Media-Server/issues/6933 + */ @Test public void testRestartServerUnderHttpLoad() {