package org.csstudio.platform.statistic;

import org.csstudio.platform.logging.CentralLogger;

public class BackgroundCollectorThread extends Thread{
	
	private int	timeout	= 0;
	private boolean runForever	= true;
	
	BackgroundCollectorThread (  int timeout) {
		this.timeout = timeout;
		CentralLogger.getInstance().info(this, "BackgroundCollectorThread started");
		this.start();
	}
	
public void run() {
	
	while (runForever) {
		
		BackgroundCollector.getInstance().getMemoryAvailableApplication().setValue( new Double(Runtime.getRuntime().totalMemory()/1000.0));
		BackgroundCollector.getInstance().getMemoryUsedApplication().setValue( new Double(Runtime.getRuntime().maxMemory()/1000.0));
//		TODO: find out how to fill these!
//		before uncommenting: enable instanciating in BackgroundCollector!!
//		BackgroundCollector.getInstance().getCpuUsedApplication().setValue
//		BackgroundCollector.getInstance().getCpuUsedSystem().setValue
//		BackgroundCollector.getInstance().getMemoryUsedSystem().setValue
		
			try {
				Thread.sleep(this.timeout);

			} catch (InterruptedException e) {
				// TODO: handle exception
			} finally {
				//clean up
			}
		}		
		CentralLogger.getInstance().info(this, "BackgroundCollectorThread stopped");
		
	}

}

@@ -207,18 +207,59 @@
 = true;%0A
+%09final static double MB = 1024.0*1024.0;%0A
 %09%0A
-
 %09Backgro
@@ -582,13 +582,12 @@
 e().
-total
+free
 Memo
@@ -587,30 +587,26 @@
 reeMemory()/
-1000.0
+MB
 ));%0A%09%09Backgr
@@ -661,32 +661,152 @@
 tion().setValue(
+ new Double(Runtime.getRuntime().totalMemory()/MB));%0A%09%09BackgroundCollector.getInstance().getMemoryUsedSystem().setValue(
  new Double(Runt
@@ -838,14 +838,10 @@
 y()/
-1000.0
+MB
 ));%0A
@@ -1012,32 +1012,32 @@
 tion().setValue%0A
+
 //%09%09BackgroundCo
@@ -1090,77 +1090,8 @@
 lue%0A
-//%09%09BackgroundCollector.getInstance().getMemoryUsedSystem().setValue%0A
 %09%09%0A%09

Add max Memory to statitic collector