package org.bench4q.monitor.file.Linux;

import java.io.FileNotFoundException;
import java.io.PrintWriter;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;

import org.bench4q.monitor.model.SystemModel;
import org.bench4q.monitor.performance.linux.SystemMonitor;
import org.bench4q.monitor.files.Write;
public class WriteSystemLinux extends Write {
		private SystemMonitor SystemMonitor;
		public WriteSystemLinux(PrintWriter out,int idleTime) throws FileNotFoundException{
			this.out=out;
			this.SystemMonitor=new SystemMonitor();
			this.idleTime=idleTime;
		}
		public void run(){
			try{
				 JAXBContext context = JAXBContext.newInstance(SystemModel.class);  
			     Marshaller marshaller = context.createMarshaller();  
			   SystemModel SystemModel=SystemMonitor.getSystemInfo(idleTime);
			     marshaller.marshal(SystemModel, out);  
			}
			catch(Exception e){
				System.out.println(e);
			}
			
		}

}
