Changeset 53
- Timestamp:
- 04/01/05 23:23:55 (4 years ago)
- Files:
-
- trunk/MacFaceFloat/MacFaceApp.cs (modified) (6 diffs)
- trunk/MacFaceLibrary/MemoryUsageCounter.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
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; … … 115 115 statusWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 116 116 statusWindow.ControlBox = false; 117 statusWindow.MaximizeBox = false; 118 statusWindow.MinimizeBox = false; 117 119 statusWindow.Icon = new Icon(asm.GetManifestResourceStream("MacFace.FloatApp.App.ico")); 118 120 statusWindow.Text = "�X�e�[�^�X"; … … 383 385 Graphics g = Graphics.FromImage(memoryGraph); 384 386 387 int totalMemory = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024; 388 double rate = 100.0 / MemoryUsageCounter.CommitLimit; 389 int border = (int)(totalMemory * rate); 390 385 391 g.FillRectangle(new SolidBrush(Color.White), 0, 0, 300, 100); 386 392 Pen pen = new Pen(Color.FromArgb(220, 220, 220), 1F); 387 for (int y = 100; y > 0; y -= 7)393 for (int y = 100; y > 0; y -= (int)(128*1024*1024 * rate)) 388 394 { 389 395 g.DrawLine(pen, 0, y, 300, y); 390 396 } 391 g.DrawLine(Pens.Gray, 0, 100-5*7, 300, 100-5*7);392 393 int totalMemory = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024;394 double rate = 70.0 / totalMemory;395 397 396 398 g.SmoothingMode = SmoothingMode.None; 397 399 Brush commitedBrush = new SolidBrush(Color.FromArgb(180, 255, 145, 0)); 398 400 Brush uncommitedBrush = new SolidBrush(Color.FromArgb(180, 180, 200, 255)); 399 Brush availableBrush = new SolidBrush(Color.FromArgb(1 80, 100, 100, 255));400 Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 2 55, 255, 100));401 Brush availableBrush = new SolidBrush(Color.FromArgb(100, 100, 100, 255)); 402 Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255)); 401 403 402 404 int pos = memHistoryHead - 1; … … 411 413 w = 5; 412 414 413 h = 30;415 h = 100 - border; 414 416 y = 0; 415 417 g.FillRectangle(spaceBrush, x, y, w, h); … … 419 421 g.FillRectangle(commitedBrush, x, y, w, h); 420 422 421 if (h < 70)422 { 423 h = 70- h;424 y = 30;423 if (h < border) 424 { 425 h = border - h; 426 y = 100 - border; 425 427 g.FillRectangle(uncommitedBrush, x, y, w, h); 426 428 } 427 429 428 430 h = (int)(usage.Available * rate); 429 y = 100 -70;431 y = 100 - border; 430 432 g.FillRectangle(availableBrush, x, y, w, h); 431 433 … … 444 446 pos--; 445 447 } 446 g.DrawLine(Pens.Black, 0, 100-70, 300, 100-70); 448 Pen borderPen = new Pen(Color.Blue); 449 borderPen.DashStyle = DashStyle.Dash; 450 g.DrawLine(borderPen, 0, 100-border, 300, 100-border); 447 451 448 452 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 }
