// Path: src/org/bootchart/common/CPUSample.java
// public class CPUSample extends Sample {
// 	/** User load. */
// 	public double user;
// 	/** System load. */
// 	public double sys;
// 	/** The percentage of CPU time spent waiting on disk I/O. */
// 	public double io;
// 
// 	/**
// 	 * Creates a new sample.
// 	 *
// 	 * @param time  sample time
// 	 * @param user  user load
// 	 * @param sys   system load
// 	 * @param io    IO wait
// 	 */
// 	public CPUSample(Date time, double user, double sys, double io) {
// 		this.time = time != null ? new Date(time.getTime()) : null;
// 		this.user = user;
// 		this.sys = sys;
// 		this.io = io;
// 	}
// 
// 	/**
// 	 * Returns the string representation of the sample.
// 	 * 
// 	 * @return  string representation
// 	 */
// 	public String toString() {
// 		String t = time != null ? time.getTime() + "\t" : "";
// 		return t + user + "\t" + sys + "\t" + io;
// 	}
// }
// 
// Path: src/org/bootchart/common/ProcessSample.java
// public class ProcessSample extends Sample {
// 	/** Process state. */
// 	public int state;
// 	/** CPU statistics. */
// 	public CPUSample cpu;
// 	/** Disk utlization statistics. */
// 	public DiskUtilSample diskUtil;
// 	/** Disk troughput statistics. */
// 	public DiskTPutSample diskTPut;
// 	
// 	/**
// 	 * Creates a new process sample.
// 	 * 
// 	 * @param time      sample time
// 	 * @param state     proces state
// 	 * @param cpu       CPU sample
// 	 * @param diskUtil  disk utilization sample
// 	 * @param diskTPut  disk throughput sample
// 	 */
// 	public ProcessSample(Date time, int state, CPUSample cpu,
// 		                 DiskUtilSample diskUtil, DiskTPutSample diskTPut) {
// 		this.time = time != null ? new Date(time.getTime()) : null;
// 		this.state = state;
// 		this.cpu = cpu;
// 		this.diskUtil = diskUtil;
// 		this.diskTPut = diskTPut;
// 	}
// 	
// 	/**
// 	 * Returns the string representation of the sample.
// 	 * 
// 	 * @return  string representation
// 	 */
// 	public String toString() {
// 		return time.getTime() + "\t" + state + "\t" + cpu + "\t" + diskUtil + "\t" + diskTPut;
// 	}
// }
// 
// Path: src/org/bootchart/common/PsStats.java
// public class PsStats {
// 	/** A list of processes (with enclosing CPU samples). */
// 	public List processList;
// 	/** Statistics sampling period. */
// 	public int samplePeriod;
// 	/** Start and end of sampling period. */
// 	public Date startTime;
// 	public Date endTime;
// }


import org.bootchart.common.CPUSample;
import org.bootchart.common.Common;
import org.bootchart.common.Process;
import org.bootchart.common.ProcessSample;
import org.bootchart.common.PsStats;
import org.bootchart.common.Sample;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Logger;
			Process p = (Process)i.next();
			if (p.samples.size() > 0) {
			  Sample fs = (Sample)p.samples.get(0);
			  p.startTime = new Date(Math.min(fs.time.getTime(), p.startTime.getTime()));
			  Sample ls = (Sample)p.samples.get(p.samples.size() - 1);
			  p.duration = ls.time.getTime() - p.startTime.getTime() + samplePeriod;
            } else {
              p.duration = 0;
            }
			
			/*
			 * Check if the pid-name map provides detailed information about
			 * the process.
			 */
			if (pidNameMap != null &&
				pidNameMap.containsKey(new Integer(p.pid))) {
				String[] cmdDesc = (String[])pidNameMap.get(new Integer(p.pid));
				p.cmd = cmdDesc[0];
				StringBuffer desc = new StringBuffer();
				if (cmdDesc.length > 1) {
					desc.append(cmdDesc[1]);
					for (int j=2; j<cmdDesc.length; j++) {
						desc.append("\n" + cmdDesc[j]);
					}
				}
				p.desc = desc.toString();
			}
			
			int activeSamples = 0;
			for (Iterator j=p.samples.iterator(); j.hasNext(); ) {
// Path: src/org/bootchart/common/CPUSample.java
// public class CPUSample extends Sample {
// 	/** User load. */
// 	public double user;
// 	/** System load. */
// 	public double sys;
// 	/** The percentage of CPU time spent waiting on disk I/O. */
// 	public double io;
// 
// 	/**
// 	 * Creates a new sample.
// 	 *
// 	 * @param time  sample time
// 	 * @param user  user load
// 	 * @param sys   system load
// 	 * @param io    IO wait
// 	 */
// 	public CPUSample(Date time, double user, double sys, double io) {
// 		this.time = time != null ? new Date(time.getTime()) : null;
// 		this.user = user;
// 		this.sys = sys;
// 		this.io = io;
// 	}
// 
// 	/**
// 	 * Returns the string representation of the sample.
// 	 * 
// 	 * @return  string representation
// 	 */
// 	public String toString() {
// 		String t = time != null ? time.getTime() + "\t" : "";
// 		return t + user + "\t" + sys + "\t" + io;
// 	}
// }
// 
// Path: src/org/bootchart/common/ProcessSample.java
// public class ProcessSample extends Sample {
// 	/** Process state. */
// 	public int state;
// 	/** CPU statistics. */
// 	public CPUSample cpu;
// 	/** Disk utlization statistics. */
// 	public DiskUtilSample diskUtil;
// 	/** Disk troughput statistics. */
// 	public DiskTPutSample diskTPut;
// 	
// 	/**
// 	 * Creates a new process sample.
// 	 * 
// 	 * @param time      sample time
// 	 * @param state     proces state
// 	 * @param cpu       CPU sample
// 	 * @param diskUtil  disk utilization sample
// 	 * @param diskTPut  disk throughput sample
// 	 */
// 	public ProcessSample(Date time, int state, CPUSample cpu,
// 		                 DiskUtilSample diskUtil, DiskTPutSample diskTPut) {
// 		this.time = time != null ? new Date(time.getTime()) : null;
// 		this.state = state;
// 		this.cpu = cpu;
// 		this.diskUtil = diskUtil;
// 		this.diskTPut = diskTPut;
// 	}
// 	
// 	/**
// 	 * Returns the string representation of the sample.
// 	 * 
// 	 * @return  string representation
// 	 */
// 	public String toString() {
// 		return time.getTime() + "\t" + state + "\t" + cpu + "\t" + diskUtil + "\t" + diskTPut;
// 	}
// }
// 
// Path: src/org/bootchart/common/PsStats.java
// public class PsStats {
// 	/** A list of processes (with enclosing CPU samples). */
// 	public List processList;
// 	/** Statistics sampling period. */
// 	public int samplePeriod;
// 	/** Start and end of sampling period. */
// 	public Date startTime;
// 	public Date endTime;
// }


// Path: src/org/bootchart/parser/linux/ProcPsParser.java
import org.bootchart.common.CPUSample;
import org.bootchart.common.Common;
import org.bootchart.common.Process;
import org.bootchart.common.ProcessSample;
import org.bootchart.common.PsStats;
import org.bootchart.common.Sample;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Logger;

			Process p = (Process)i.next();
			if (p.samples.size() > 0) {
			  Sample fs = (Sample)p.samples.get(0);
			  p.startTime = new Date(Math.min(fs.time.getTime(), p.startTime.getTime()));
			  Sample ls = (Sample)p.samples.get(p.samples.size() - 1);
			  p.duration = ls.time.getTime() - p.startTime.getTime() + samplePeriod;
            } else {
              p.duration = 0;
            }
			
			/*
			 * Check if the pid-name map provides detailed information about
			 * the process.
			 */
			if (pidNameMap != null &&
				pidNameMap.containsKey(new Integer(p.pid))) {
				String[] cmdDesc = (String[])pidNameMap.get(new Integer(p.pid));
				p.cmd = cmdDesc[0];
				StringBuffer desc = new StringBuffer();
				if (cmdDesc.length > 1) {
					desc.append(cmdDesc[1]);
					for (int j=2; j<cmdDesc.length; j++) {
						desc.append("\n" + cmdDesc[j]);
					}
				}
				p.desc = desc.toString();
			}
			
			int activeSamples = 0;
			for (Iterator j=p.samples.iterator(); j.hasNext(); ) {
				ProcessSample sample = (ProcessSample)j.next();