Changeset 53
- Timestamp:
- Apr 1, 2005, 11:23:55 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MacFaceFloat/MacFaceApp.cs
r52 r53 56 56 config.Load(); 57 57 58 cpuHistory = new CPUUsage[6 0];58 cpuHistory = new CPUUsage[61]; 59 59 cpuHistoryCount = 0; 60 60 cpuHistoryHead = 0; 61 61 62 memHistory = new MemoryUsage[6 0];62 memHistory = new MemoryUsage[61]; 63 63 memHistoryCount = 0; 64 64 memHistoryHead = 0; … … 116 116 statusWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 117 117 statusWindow.ControlBox = false; 118 statusWindow.MaximizeBox = false; 119 statusWindow.MinimizeBox = false; 118 120 statusWindow.Icon = new Icon(asm.GetManifestResourceStream("MacFace.FloatApp.App.ico")); 119 121 statusWindow.Text = "Xe[^X"; … … 386 388 Graphics g = Graphics.FromImage(memoryGraph); 387 389 390 int totalMemory = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024; 391 double rate = 100.0 / MemoryUsageCounter.CommitLimit; 392 int border = (int)(totalMemory * rate); 393 388 394 g.FillRectangle(new SolidBrush(Color.White), 0, 0, 300, 100); 389 395 Pen pen = new Pen(Color.FromArgb(220, 220, 220), 1F); 390 for (int y = 100; y > 0; y -= 7)396 for (int y = 100; y > 0; y -= (int)(128*1024*1024 * rate)) 391 397 { 392 398 g.DrawLine(pen, 0, y, 300, y); 393 399 } 394 g.DrawLine(Pens.Gray, 0, 100-5*7, 300, 100-5*7);395 396 int totalMemory = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024;397 double rate = 70.0 / totalMemory;398 400 399 401 g.SmoothingMode = SmoothingMode.None; 400 402 Brush commitedBrush = new SolidBrush(Color.FromArgb(180, 255, 145, 0)); 401 403 Brush uncommitedBrush = new SolidBrush(Color.FromArgb(180, 180, 200, 255)); 402 Brush availableBrush = new SolidBrush(Color.FromArgb(1 80, 100, 100, 255));403 Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 2 55, 255, 100));404 Brush availableBrush = new SolidBrush(Color.FromArgb(100, 100, 100, 255)); 405 Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255)); 404 406 405 407 int pos = memHistoryHead - 1; … … 414 416 w = 5; 415 417 416 h = 30;418 h = 100 - border; 417 419 y = 0; 418 420 g.FillRectangle(spaceBrush, x, y, w, h); … … 422 424 g.FillRectangle(commitedBrush, x, y, w, h); 423 425 424 if (h < 70)425 { 426 h = 70- h;427 y = 30;426 if (h < border) 427 { 428 h = border - h; 429 y = 100 - border; 428 430 g.FillRectangle(uncommitedBrush, x, y, w, h); 429 431 } 430 432 431 433 h = (int)(usage.Available * rate); 432 y = 100 -70;434 y = 100 - border; 433 435 g.FillRectangle(availableBrush, x, y, w, h); 434 436 … … 447 449 pos--; 448 450 } 449 g.DrawLine(Pens.Black, 0, 100-70, 300, 100-70); 451 Pen borderPen = new Pen(Color.Blue); 452 borderPen.DashStyle = DashStyle.Dash; 453 g.DrawLine(borderPen, 0, 100-border, 300, 100-border); 450 454 451 455 g.Dispose(); -
trunk/MacFaceLibrary/MemoryUsageCounter.cs
r47 r53 13 13 { 14 14 private static ulong totalVisibleMemorySize; 15 private static PerformanceCounter commitLimitCounter; 15 16 16 17 private PerformanceCounter availableCounter; … … 27 28 totalVisibleMemorySize = (ulong)mo["TotalVisibleMemorySize"]; 28 29 } 30 31 commitLimitCounter = new PerformanceCounter(); 32 commitLimitCounter.CategoryName = "Memory"; 33 commitLimitCounter.CounterName = "Commit Limit"; 29 34 } 30 35 … … 62 67 get { return totalVisibleMemorySize; } 63 68 } 69 70 public static ulong CommitLimit 71 { 72 get { return (ulong)commitLimitCounter.NextValue(); } 73 } 64 74 } 65 75 }
Note: See TracChangeset
for help on using the changeset viewer.