Skip to content
Snippets Groups Projects
Commit 7ed6b882 authored by srosse's avatar srosse
Browse files

OO-4633: show number of video streams in runtime infos

parent d1f1a791
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,6 @@ import java.util.TimeZone; ...@@ -35,7 +35,6 @@ import java.util.TimeZone;
import org.olat.admin.sysinfo.manager.SessionStatsManager; import org.olat.admin.sysinfo.manager.SessionStatsManager;
import org.olat.admin.sysinfo.model.SessionsStats; import org.olat.admin.sysinfo.model.SessionsStats;
import org.olat.basesecurity.BaseSecurity; import org.olat.basesecurity.BaseSecurity;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement; import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement;
...@@ -48,6 +47,7 @@ import org.olat.core.helpers.Settings; ...@@ -48,6 +47,7 @@ import org.olat.core.helpers.Settings;
import org.olat.core.util.Formatter; import org.olat.core.util.Formatter;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.WebappHelper; import org.olat.core.util.WebappHelper;
import org.springframework.beans.factory.annotation.Autowired;
/** /**
...@@ -58,8 +58,10 @@ import org.olat.core.util.WebappHelper; ...@@ -58,8 +58,10 @@ import org.olat.core.util.WebappHelper;
*/ */
public class SysinfoController extends FormBasicController { public class SysinfoController extends FormBasicController {
private final BaseSecurity securityManager; @Autowired
private final SessionStatsManager sessionStatsManager; private BaseSecurity securityManager;
@Autowired
private SessionStatsManager sessionStatsManager;
/** /**
* @param ureq * @param ureq
...@@ -67,10 +69,6 @@ public class SysinfoController extends FormBasicController { ...@@ -67,10 +69,6 @@ public class SysinfoController extends FormBasicController {
*/ */
public SysinfoController(UserRequest ureq, WindowControl wControl) { public SysinfoController(UserRequest ureq, WindowControl wControl) {
super(ureq, wControl, "sysinfo"); super(ureq, wControl, "sysinfo");
securityManager = CoreSpringFactory.getImpl(BaseSecurity.class);
sessionStatsManager = CoreSpringFactory.getImpl(SessionStatsManager.class);
initForm(ureq); initForm(ureq);
} }
...@@ -97,7 +95,16 @@ public class SysinfoController extends FormBasicController { ...@@ -97,7 +95,16 @@ public class SysinfoController extends FormBasicController {
int controllerCnt = DefaultController.getControllerCount(); int controllerCnt = DefaultController.getControllerCount();
uifactory.addStaticTextElement("controllercount", "runtime.controllercount", Integer.toString(controllerCnt), runtimeCont); uifactory.addStaticTextElement("controllercount", "runtime.controllercount", Integer.toString(controllerCnt), runtimeCont);
int numOfDispatchingThreads = sessionStatsManager.getConcurrentCounter(); int numOfDispatchingThreads = sessionStatsManager.getConcurrentCounter();
uifactory.addStaticTextElement("dispatchingthreads", "runtime.dispatchingthreads", Integer.toString(numOfDispatchingThreads), runtimeCont); int numOfDispatchingStreams = sessionStatsManager.getConcurrentStreamCounter();
String threadsInfos;
if(numOfDispatchingStreams == 0) {
threadsInfos = Integer.toString(numOfDispatchingThreads);
} else {
threadsInfos = translate("runtime.dispatchingthreads.infos", new String[] {
Integer.toString(numOfDispatchingThreads - numOfDispatchingStreams), Integer.toString(numOfDispatchingStreams)
});
}
uifactory.addStaticTextElement("dispatchingthreads", "runtime.dispatchingthreads", threadsInfos, runtimeCont);
//sessions and clicks //sessions and clicks
String sessionAndClicksPage = velocity_root + "/session_clicks.html"; String sessionAndClicksPage = velocity_root + "/session_clicks.html";
......
...@@ -173,6 +173,7 @@ run.gc=Java Garbage Collection jetzt starten ...@@ -173,6 +173,7 @@ run.gc=Java Garbage Collection jetzt starten
runtime=Runtime Informationen runtime=Runtime Informationen
runtime.controllercount=Controllers (Aktiv und nicht aufger\u00E4umt) runtime.controllercount=Controllers (Aktiv und nicht aufger\u00E4umt)
runtime.dispatchingthreads=Gleichzeitige arbeitende Threads runtime.dispatchingthreads=Gleichzeitige arbeitende Threads
runtime.dispatchingthreads.infos={0} und {1} Video Streams
runtime.memory=Speicher runtime.memory=Speicher
runtime.memory.permGen=Speicher (Permanent Generation) runtime.memory.permGen=Speicher (Permanent Generation)
runtime.memory.tooltip={0} MB von {1} MB belegt runtime.memory.tooltip={0} MB von {1} MB belegt
......
...@@ -173,6 +173,7 @@ run.gc=Run garbage collection ...@@ -173,6 +173,7 @@ run.gc=Run garbage collection
runtime=Runtime infos runtime=Runtime infos
runtime.controllercount=Controllers (active and not disposed) runtime.controllercount=Controllers (active and not disposed)
runtime.dispatchingthreads=Concurrent dispatching threads runtime.dispatchingthreads=Concurrent dispatching threads
runtime.dispatchingthreads.infos={0} and {1} videos streams
runtime.memory=Memory runtime.memory=Memory
runtime.memory.permGen=Memory (Permanent Generation) runtime.memory.permGen=Memory (Permanent Generation)
runtime.memory.tooltip={0} MB of {1} MB available runtime.memory.tooltip={0} MB of {1} MB available
......
...@@ -47,7 +47,8 @@ public class SessionStatsManager implements Sampler { ...@@ -47,7 +47,8 @@ public class SessionStatsManager implements Sampler {
private UserSessionManager sessionManager; private UserSessionManager sessionManager;
private SessionStatsSample currentSample; private SessionStatsSample currentSample;
private AtomicInteger concurrentCounter = new AtomicInteger(0); private final AtomicInteger concurrentCounter = new AtomicInteger(0);
private final AtomicInteger concurrentStreamCounter = new AtomicInteger(0);
private List<SessionStatsSample> sessionStatsSamples = new ArrayList<>(); private List<SessionStatsSample> sessionStatsSamples = new ArrayList<>();
public List<SessionStatsSample> getSessionViews() { public List<SessionStatsSample> getSessionViews() {
...@@ -89,7 +90,19 @@ public class SessionStatsManager implements Sampler { ...@@ -89,7 +90,19 @@ public class SessionStatsManager implements Sampler {
public void decrementConcurrentCounter() { public void decrementConcurrentCounter() {
concurrentCounter.decrementAndGet(); concurrentCounter.decrementAndGet();
} }
public int getConcurrentStreamCounter() {
return concurrentStreamCounter.intValue();
}
public void incrementConcurrentStreamCounter() {
concurrentStreamCounter.incrementAndGet();
}
public void decrementConcurrentStreamCounter() {
concurrentStreamCounter.decrementAndGet();
}
public synchronized long getNumOfSessions() { public synchronized long getNumOfSessions() {
if(currentSample != null) { if(currentSample != null) {
return currentSample.getNumOfSessions(); return currentSample.getNumOfSessions();
......
...@@ -45,13 +45,14 @@ import javax.servlet.http.HttpServletRequest; ...@@ -45,13 +45,14 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.Logger;
import org.olat.admin.sysinfo.manager.SessionStatsManager;
import org.olat.core.CoreSpringFactory; import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.Windows; import org.olat.core.gui.Windows;
import org.olat.core.gui.render.StringOutput; import org.olat.core.gui.render.StringOutput;
import org.olat.core.gui.util.bandwidth.SlowBandWidthSimulator; import org.olat.core.gui.util.bandwidth.SlowBandWidthSimulator;
import org.olat.core.helpers.Settings; import org.olat.core.helpers.Settings;
import org.olat.core.logging.AssertException; import org.olat.core.logging.AssertException;
import org.apache.logging.log4j.Logger;
import org.olat.core.logging.Tracing; import org.olat.core.logging.Tracing;
import org.olat.core.util.FileUtils; import org.olat.core.util.FileUtils;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
...@@ -252,13 +253,21 @@ public class ServletUtil { ...@@ -252,13 +253,21 @@ public class ServletUtil {
protected static void copy(OutputStream ostream, InputStream resourceInputStream, Range range, int bufferSize) throws IOException { protected static void copy(OutputStream ostream, InputStream resourceInputStream, Range range, int bufferSize) throws IOException {
IOException exception = null; IOException exception = null;
InputStream istream = (resourceInputStream instanceof BufferedInputStream) SessionStatsManager stats = CoreSpringFactory.getImpl(SessionStatsManager.class);
? resourceInputStream : new BufferedInputStream(resourceInputStream, bufferSize);
exception = copyRange(istream, ostream, range.start, range.end, bufferSize); try(InputStream istream = (resourceInputStream instanceof BufferedInputStream)
? resourceInputStream : new BufferedInputStream(resourceInputStream, bufferSize)) {
// Clean up the input stream stats.incrementConcurrentStreamCounter();
istream.close(); Thread.sleep(5000);
exception = copyRange(istream, ostream, range.start, range.end, bufferSize);
} catch(IOException e) {
handleIOException("Deliver range of data", e);
} catch(Exception e) {
log.error("", e);
} finally {
stats.decrementConcurrentStreamCounter();
}
// Rethrow any exception that has occurred // Rethrow any exception that has occurred
if (exception != null) throw exception; if (exception != null) throw exception;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment