Index: /trunk/MacFaceFloat/MacFaceApp.cs
===================================================================
--- /trunk/MacFaceFloat/MacFaceApp.cs	(revision 60)
+++ /trunk/MacFaceFloat/MacFaceApp.cs	(revision 61)
@@ -29,6 +29,4 @@
 		
 		private System.Windows.Forms.Timer updateTimer;
-		private CPUUsageCounter cpuCounter;
-		private MemoryUsageCounter memoryCounter;
 
 		private StatusWindow statusWindow;
@@ -36,11 +34,6 @@
 		private Bitmap memoryGraph;
 
-		private CPUUsage[] cpuHistory;
-		private int cpuHistoryHead;
-		private int cpuHistoryCount;
-
-		private MemoryUsage[] memHistory;
-		private int memHistoryHead;
-		private int memHistoryCount;
+		private CPUStatistics cpuStats;
+		private MemoryStatistics memStats;
 
 		[STAThread]
@@ -56,14 +49,6 @@
 			config.Load();
 
-			cpuHistory = new CPUUsage[61];
-			cpuHistoryCount = 0;
-			cpuHistoryHead = 0;
-
-			memHistory = new MemoryUsage[61];
-			memHistoryCount = 0;
-			memHistoryHead = 0;
-
-			cpuCounter = new CPUUsageCounter();
-			memoryCounter = new MemoryUsageCounter();
+			cpuStats = new CPUStatistics(61);
+			memStats = new MemoryStatistics(61);
 
 			updateTimer = new System.Windows.Forms.Timer();
@@ -204,15 +189,10 @@
 		public void CountProcessorUsage(object sender, EventArgs e)
 		{
-			CPUUsage cpuUsage = cpuCounter.CurrentUsage();
-			MemoryUsage memUsage = memoryCounter.CurrentUsage();
-
-			cpuHistory[cpuHistoryHead++] = cpuUsage;
-			if (cpuHistoryHead >= cpuHistory.Length) cpuHistoryHead = 0;
-			if (cpuHistoryCount < cpuHistory.Length) cpuHistoryCount++;
-
-			memHistory[memHistoryHead++] = memUsage;
-			if (memHistoryHead >= memHistory.Length) memHistoryHead = 0;
-			if (memHistoryCount < memHistory.Length) memHistoryCount++;
-
+			cpuStats.Update();
+			CPUUsage cpuUsage = cpuStats.Latest;
+
+			memStats.Update();
+			MemoryUsage memUsage = memStats.Latest;
+			
 			if (patternWindow != null) 
 			{
@@ -220,5 +200,5 @@
 
 				int pattern = cpuUsage.Active / 10;
-				int avilable = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024 - memUsage.Committed;
+				int avilable = (int)memStats.TotalVisibleMemorySize * 1024 - memUsage.Committed;
 				if (avilable < (10 * 1024 *1024)) 
 				{
@@ -360,28 +340,27 @@
 			g.DrawLine(Pens.Gray, 0, 50, 300, 50);
 
-			if (cpuHistoryCount >= 2) 
-			{
-				Point[] userGraph = new Point[cpuHistoryCount+2];
-				Point[] sysGraph = new Point[cpuHistoryCount+2];
-
-				userGraph[cpuHistoryCount+0].X = 300 - (cpuHistoryCount-1) * 5;
-				userGraph[cpuHistoryCount+0].Y = 100 - 0;
-				userGraph[cpuHistoryCount+1].X = 300 - 0 * 5;
-				userGraph[cpuHistoryCount+1].Y = 100 - 0;
-
-				sysGraph[cpuHistoryCount+0].X = 300 - (cpuHistoryCount-1) * 5;
-				sysGraph[cpuHistoryCount+0].Y = 100 - 0;
-				sysGraph[cpuHistoryCount+1].X = 300 - 0 * 5;
-				sysGraph[cpuHistoryCount+1].Y = 100 - 0;
-
-				int pos = cpuHistoryHead - 1;
-				for (int i = 0; i < cpuHistoryCount; i++) 
+			int count = cpuStats.Count;
+
+			if (count >= 2) 
+			{
+				Point[] userGraph = new Point[count+2];
+				Point[] sysGraph = new Point[count+2];
+
+				userGraph[count+0].X = 300 - (count-1) * 5;
+				userGraph[count+0].Y = 100 - 0;
+				userGraph[count+1].X = 300 - 0 * 5;
+				userGraph[count+1].Y = 100 - 0;
+
+				sysGraph[count+0].X = 300 - (count-1) * 5;
+				sysGraph[count+0].Y = 100 - 0;
+				sysGraph[count+1].X = 300 - 0 * 5;
+				sysGraph[count+1].Y = 100 - 0;
+
+				for (int i = 0; i < count; i++) 
 				{
-					if (pos < 0) pos = cpuHistory.Length - 1;
-					CPUUsage usage = cpuHistory[pos];
+					CPUUsage usage = cpuStats[i];
 					userGraph[i].X = sysGraph[i].X = 300 - i * 5;
 					userGraph[i].Y = 100 - usage.Active;
 					sysGraph[i].Y = 100 - usage.System;
-					pos--;
 				}
 
@@ -398,6 +377,6 @@
 			Graphics g = Graphics.FromImage(memoryGraph);
 
-			int totalMemory = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024;
-			double rate = 100.0 / MemoryUsageCounter.CommitLimit;
+			int totalMemory = (int)memStats.TotalVisibleMemorySize * 1024;
+			double rate = 100.0 / memStats.CommitLimit;
 			int border = (int)(totalMemory * rate);
 
@@ -417,9 +396,9 @@
 			Brush spaceBrush = new SolidBrush(Color.FromArgb(100, 100, 100, 255));
 
-			int pos = memHistoryHead - 1;
-			for (int i = 0; i < memHistoryCount; i++) 
-			{
-				if (pos < 0) pos = memHistory.Length - 1;
-				MemoryUsage usage = memHistory[pos];
+			int count = memStats.Count;
+
+			for (int i = 0; i < count; i++) 
+			{
+				MemoryUsage usage = memStats[i];
 
 				int x = 300 - i * 5 - 5;
@@ -461,6 +440,4 @@
 				y = 100 - h;
 				g.FillRectangle(Brushes.Black, x, y, w, h);
-
-				pos--;
 			}
 			Pen borderPen = new Pen(Color.Blue);
Index: /trunk/MacFaceLibrary/CPUStatistics.cs
===================================================================
--- /trunk/MacFaceLibrary/CPUStatistics.cs	(revision 61)
+++ /trunk/MacFaceLibrary/CPUStatistics.cs	(revision 61)
@@ -0,0 +1,83 @@
+using System;
+using System.Diagnostics;
+
+namespace MacFace
+{
+	/// <summary>
+	/// CPUStats ÌTvÌà¾Å·B
+	/// </summary>
+	public class CPUStatistics
+	{
+		private CPUUsage[] history;
+		private int length;
+		private int head;
+		private int count;
+
+		private CPUUsage latest;
+
+		private PerformanceCounter userCounter;
+		private PerformanceCounter systemCounter;
+		private PerformanceCounter idleCounter;
+
+		public CPUStatistics(int historySize)
+		{
+			history = new CPUUsage[historySize];
+			length = historySize;
+			count = 0;
+			head = 0;
+
+			userCounter = new PerformanceCounter();
+			userCounter.CategoryName = "Processor";
+			userCounter.CounterName = "% User Time";
+			userCounter.InstanceName = "_Total";
+
+			systemCounter = new PerformanceCounter();
+			systemCounter.CategoryName = "Processor";
+			systemCounter.CounterName = "% Privileged Time";
+			systemCounter.InstanceName = "_Total";
+
+			idleCounter = new PerformanceCounter();
+			idleCounter.CategoryName = "Processor";
+			idleCounter.CounterName = "% Idle Time";
+			idleCounter.InstanceName = "_Total";
+		}
+
+		public CPUUsage Latest 
+		{
+			get { return latest; }
+		}
+
+		public CPUUsage this[int index]
+		{
+			get {
+				index = head - index - 1;
+				if (index < 0) index += length;
+				return history[index];
+			}
+		}
+
+		public int Count 
+		{
+			get { return count; }
+		}
+
+		public void Update() 
+		{
+			latest = NextValue();
+			history[head++] = latest;
+
+			if (head >= length) head = 0;
+			if (count < length) count++;
+		}
+
+		protected CPUUsage NextValue()
+		{
+			int user   = (int)userCounter.NextValue();
+			int system = (int)systemCounter.NextValue();
+			int idle   = (int)idleCounter.NextValue();
+
+			return new CPUUsage(user, system, idle);
+		}
+	
+	}
+}
Index: unk/MacFaceLibrary/CPUUsageCounter.cs
===================================================================
--- /trunk/MacFaceLibrary/CPUUsageCounter.cs	(revision 60)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * $Id$
- */
-using System;
-using System.Diagnostics;
-
-namespace MacFace
-{
-	/// <summary>
-	/// HostStatistics ÌTvÌà¾Å·B
-	/// </summary>
-	public class CPUUsageCounter
-	{
-		private PerformanceCounter userCounter;
-		private PerformanceCounter systemCounter;
-		private PerformanceCounter idleCounter;
-
-		public CPUUsageCounter()
-		{
-			userCounter = new PerformanceCounter();
-			userCounter.CategoryName = "Processor";
-			userCounter.CounterName = "% User Time";
-			userCounter.InstanceName = "_Total";
-
-			systemCounter = new PerformanceCounter();
-			systemCounter.CategoryName = "Processor";
-			systemCounter.CounterName = "% Privileged Time";
-			systemCounter.InstanceName = "_Total";
-
-			idleCounter = new PerformanceCounter();
-			idleCounter.CategoryName = "Processor";
-			idleCounter.CounterName = "% Idle Time";
-			idleCounter.InstanceName = "_Total";
-		}
-
-		public CPUUsage CurrentUsage()
-		{
-			int user   = (int)userCounter.NextValue();
-			int system = (int)systemCounter.NextValue();
-			int idle   = (int)idleCounter.NextValue();
-
-			return new CPUUsage(user, system, idle);
-		}
-
-	}
-}
Index: /trunk/MacFaceLibrary/MacFaceLibrary.csproj
===================================================================
--- /trunk/MacFaceLibrary/MacFaceLibrary.csproj	(revision 60)
+++ /trunk/MacFaceLibrary/MacFaceLibrary.csproj	(revision 61)
@@ -100,10 +100,10 @@
                 />
                 <File
-                    RelPath = "CPUUsage.cs"
+                    RelPath = "CPUStatistics.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
-                    RelPath = "CPUUsageCounter.cs"
+                    RelPath = "CPUUsage.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -120,10 +120,10 @@
                 />
                 <File
-                    RelPath = "MemoryUsage.cs"
+                    RelPath = "MemoryStatistics.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
-                    RelPath = "MemoryUsageCounter.cs"
+                    RelPath = "MemoryUsage.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
Index: /trunk/MacFaceLibrary/MemoryStatistics.cs
===================================================================
--- /trunk/MacFaceLibrary/MemoryStatistics.cs	(revision 61)
+++ /trunk/MacFaceLibrary/MemoryStatistics.cs	(revision 61)
@@ -0,0 +1,142 @@
+using System;
+using System.Diagnostics;
+
+namespace MacFace
+{
+	/// <summary>
+	/// MemoryStatistics ÌTvÌà¾Å·B
+	/// </summary>
+	public class MemoryStatistics
+	{
+		private MemoryUsage[] history;
+		private int length;
+		private int head;
+		private int count;
+
+		private MemoryUsage latest;
+
+		private PerformanceCounter availableCounter;
+		private PerformanceCounter committedCounter;
+		private PerformanceCounter pageoutCounter;
+		private PerformanceCounter pageinCounter;
+		private PerformanceCounter systemCacheCounter;
+		private PerformanceCounter kernelPagedCounter;
+		private PerformanceCounter kernelNonPagedCounter;
+		private PerformanceCounter driverTotalCounter;
+		private PerformanceCounter systemCodeTotalCounter;
+		private PerformanceCounter commitLimitCounter;
+
+		private ulong totalVisibleMemorySize;
+
+		public MemoryStatistics(int historySize)
+		{
+			history = new MemoryUsage[historySize];
+			length = historySize;
+			count = 0;
+			head = 0;
+
+			System.Management.ManagementClass mc = new System.Management.ManagementClass("Win32_OperatingSystem");
+			System.Management.ManagementObjectCollection moc = mc.GetInstances();
+			foreach (System.Management.ManagementObject mo in moc)
+			{
+				totalVisibleMemorySize = (ulong)mo["TotalVisibleMemorySize"];
+			}
+
+			availableCounter = new PerformanceCounter();
+			availableCounter.CategoryName = "Memory";
+			availableCounter.CounterName = "Available Bytes";
+
+			committedCounter = new PerformanceCounter();
+			committedCounter.CategoryName = "Memory";
+			committedCounter.CounterName = "Committed Bytes";
+
+			pageoutCounter = new PerformanceCounter();
+			pageoutCounter.CategoryName = "Memory";
+			pageoutCounter.CounterName = "Pages Output/sec";
+
+			pageinCounter = new PerformanceCounter();
+			pageinCounter.CategoryName = "Memory";
+			pageinCounter.CounterName = "Pages Input/sec";
+
+			systemCacheCounter = new PerformanceCounter();
+			systemCacheCounter.CategoryName = "Memory";
+			systemCacheCounter.CounterName = "Cache Bytes";
+
+			kernelPagedCounter = new PerformanceCounter();
+			kernelPagedCounter.CategoryName = "Memory";
+			kernelPagedCounter.CounterName = "Pool Paged Bytes";
+
+			kernelNonPagedCounter = new PerformanceCounter();
+			kernelNonPagedCounter.CategoryName = "Memory";
+			kernelNonPagedCounter.CounterName = "Pool Nonpaged Bytes";
+
+			driverTotalCounter = new PerformanceCounter();
+			driverTotalCounter.CategoryName = "Memory";
+			driverTotalCounter.CounterName = "System Driver Total Bytes";
+
+			systemCodeTotalCounter = new PerformanceCounter();
+			systemCodeTotalCounter.CategoryName = "Memory";
+			systemCodeTotalCounter.CounterName = "System Code Total Bytes";
+
+			commitLimitCounter = new PerformanceCounter();
+			commitLimitCounter.CategoryName = "Memory";
+			commitLimitCounter.CounterName = "Commit Limit";
+		}
+
+	
+		public MemoryUsage Latest 
+		{
+			get { return latest; }
+		}
+
+		public MemoryUsage this[int index]
+		{
+			get 
+			{
+				index = head - index - 1;
+				if (index < 0) index += length;
+				return history[index];
+			}
+		}
+
+		public int Count 
+		{
+			get { return count; }
+		}
+
+		public ulong TotalVisibleMemorySize 
+		{
+			get { return totalVisibleMemorySize; }
+		}
+
+		public ulong CommitLimit 
+		{
+			get { return (ulong)commitLimitCounter.NextValue(); }
+		}
+
+		public void Update() 
+		{
+			latest = NextValue();
+			history[head++] = latest;
+
+			if (head >= length) head = 0;
+			if (count < length) count++;
+		}
+
+		protected MemoryUsage NextValue()
+		{
+			int available      = (int)availableCounter.NextValue();
+			int committed      = (int)committedCounter.NextValue();
+			int pagein	       = (int)pageinCounter.NextValue();
+			int pageout        = (int)pageoutCounter.NextValue();
+			int systemCache    = (int)systemCacheCounter.NextValue();
+			int kernelPaged    = (int)kernelPagedCounter.NextValue();
+			int kernelNonPaged = (int)kernelNonPagedCounter.NextValue();
+			int driverTotal    = (int)driverTotalCounter.NextValue();
+			int systemCodeTotal = (int)systemCodeTotalCounter.NextValue();
+
+			return new MemoryUsage(available, committed, pagein, pageout,
+				systemCache, kernelPaged, kernelNonPaged, driverTotal, systemCodeTotal);
+		}
+	}
+}
Index: unk/MacFaceLibrary/MemoryUsageCounter.cs
===================================================================
--- /trunk/MacFaceLibrary/MemoryUsageCounter.cs	(revision 60)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * $Id$
- */
-using System;
-using System.Diagnostics;
-
-namespace MacFace
-{
-	/// <summary>
-	/// MemoryUsageCounter ÌTvÌà¾Å·B
-	/// </summary>
-	public class MemoryUsageCounter
-	{
-		private static ulong totalVisibleMemorySize;
-		private static PerformanceCounter commitLimitCounter;
-		
-		private PerformanceCounter availableCounter;
-		private PerformanceCounter committedCounter;
-		private PerformanceCounter pageoutCounter;
-		private PerformanceCounter pageinCounter;
-		private PerformanceCounter systemCacheCounter;
-		private PerformanceCounter kernelPagedCounter;
-		private PerformanceCounter kernelNonPagedCounter;
-		private PerformanceCounter driverTotalCounter;
-		private PerformanceCounter systemCodeTotalCounter;
-
-		static MemoryUsageCounter()
-		{
-			System.Management.ManagementClass mc = new System.Management.ManagementClass("Win32_OperatingSystem");
-			System.Management.ManagementObjectCollection moc = mc.GetInstances();
-			foreach (System.Management.ManagementObject mo in moc)
-			{
-				totalVisibleMemorySize = (ulong)mo["TotalVisibleMemorySize"];
-			}
-
-			commitLimitCounter = new PerformanceCounter();
-			commitLimitCounter.CategoryName = "Memory";
-			commitLimitCounter.CounterName = "Commit Limit";
-		}
-
-		public MemoryUsageCounter()
-		{
-			availableCounter = new PerformanceCounter();
-			availableCounter.CategoryName = "Memory";
-			availableCounter.CounterName = "Available Bytes";
-
-			committedCounter = new PerformanceCounter();
-			committedCounter.CategoryName = "Memory";
-			committedCounter.CounterName = "Committed Bytes";
-
-			pageoutCounter = new PerformanceCounter();
-			pageoutCounter.CategoryName = "Memory";
-			pageoutCounter.CounterName = "Pages Output/sec";
-
-			pageinCounter = new PerformanceCounter();
-			pageinCounter.CategoryName = "Memory";
-			pageinCounter.CounterName = "Pages Input/sec";
-
-			systemCacheCounter = new PerformanceCounter();
-			systemCacheCounter.CategoryName = "Memory";
-			systemCacheCounter.CounterName = "Cache Bytes";
-
-			kernelPagedCounter = new PerformanceCounter();
-			kernelPagedCounter.CategoryName = "Memory";
-			kernelPagedCounter.CounterName = "Pool Paged Bytes";
-
-			kernelNonPagedCounter = new PerformanceCounter();
-			kernelNonPagedCounter.CategoryName = "Memory";
-			kernelNonPagedCounter.CounterName = "Pool Nonpaged Bytes";
-
-			driverTotalCounter = new PerformanceCounter();
-			driverTotalCounter.CategoryName = "Memory";
-			driverTotalCounter.CounterName = "System Driver Total Bytes";
-
-			systemCodeTotalCounter = new PerformanceCounter();
-			systemCodeTotalCounter.CategoryName = "Memory";
-			systemCodeTotalCounter.CounterName = "System Code Total Bytes";
-		}
-
-		public MemoryUsage CurrentUsage()
-		{
-			int available      = (int)availableCounter.NextValue();
-			int committed      = (int)committedCounter.NextValue();
-			int pagein	       = (int)pageinCounter.NextValue();
-			int pageout        = (int)pageoutCounter.NextValue();
-			int systemCache    = (int)systemCacheCounter.NextValue();
-			int kernelPaged    = (int)kernelPagedCounter.NextValue();
-			int kernelNonPaged = (int)kernelNonPagedCounter.NextValue();
-			int driverTotal    = (int)driverTotalCounter.NextValue();
-			int systemCodeTotal = (int)systemCodeTotalCounter.NextValue();
-
-			return new MemoryUsage(available, committed, pagein, pageout,
-				systemCache, kernelPaged, kernelNonPaged, driverTotal, systemCodeTotal);
-		}
-
-		public static ulong TotalVisibleMemorySize 
-		{
-			get { return totalVisibleMemorySize; }
-		}
-
-		public static ulong CommitLimit 
-		{
-			get { return (ulong)commitLimitCounter.NextValue(); }
-		}
-	}
-}
