Changeset 20
- Timestamp:
- Nov 17, 2004, 9:55:59 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MacFaceFloat/MainForm.cs
r19 r20 33 33 Int32 prevUsage; 34 34 PerformanceCounter cpuCount; 35 //PerformanceCounter pageoutCount;36 //PerformanceCounter pageinCount;35 PerformanceCounter pageoutCount; 36 PerformanceCounter pageinCount; 37 37 38 38 // RXgN^ … … 50 50 cpuCount.InstanceName = "_Total"; 51 51 52 //pageoutCount = new PerformanceCounter();53 //pageoutCount.CategoryName = "Memory";54 //pageoutCount.CounterName = "Pages Output/sec";55 // 56 //pageinCount = new PerformanceCounter();57 //pageinCount.CategoryName = "Memory";58 //pageinCount.CounterName = "Pages Input/sec";52 pageoutCount = new PerformanceCounter(); 53 pageoutCount.CategoryName = "Memory"; 54 pageoutCount.CounterName = "Pages Output/sec"; 55 56 pageinCount = new PerformanceCounter(); 57 pageinCount.CategoryName = "Memory"; 58 pageinCount.CounterName = "Pages Input/sec"; 59 59 60 60 _updateTimer = new System.Windows.Forms.Timer(); … … 199 199 public void CountProcessorUsage(object sender, EventArgs e) 200 200 { 201 Int32 usage = (Int32)cpuCount.NextValue();202 // Int32 pagein = (Int32)pageinCount.NextValue();203 // Int32 pageout = (Int32)pageoutCount.NextValue();204 205 // Console.WriteLine("Processor: {0}% (pattern: {1}) {2} {3}", usage, usage/10, pagein, pageout);206 if (usage > = 100) {207 usage = 10 0;201 int usage = (int)cpuCount.NextValue(); 202 int pagein = (int)pageinCount.NextValue(); 203 int pageout = (int)pageoutCount.NextValue(); 204 205 usage /= 10; 206 if (usage > 10) { 207 usage = 10; 208 208 } else if (usage < 0) { 209 209 usage = 0; 210 210 } 211 212 if (prevUsage/10 != usage/10) { 211 212 int markers = FaceDef.MarkerNone; 213 if (pagein > 0) markers += FaceDef.MarkerPageIn; 214 if (pageout > 0) markers += FaceDef.MarkerPageOut; 215 216 if (prevUsage != usage) 217 { 213 218 Graphics g = this.Graphics; 214 219 g.Clear(Color.FromArgb(0, 0, 0, 0)); 215 _currentFaceDef.DrawPatternImage(g, FaceDef.PatternSuite.Normal, usage /10, FaceDef.MarkerNone);220 _currentFaceDef.DrawPatternImage(g, FaceDef.PatternSuite.Normal, usage, markers); 216 221 this.Update(); 217 222 }
Note: See TracChangeset
for help on using the changeset viewer.