Changeset 53

Show
Ignore:
Timestamp:
04/01/05 23:23:55 (4 years ago)
Author:
altba\rryu
Message:

メモリグラフの上限をCommit Limitに変更した。
グラフの色などを微調整。

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/MacFaceFloat/MacFaceApp.cs

    r52 r53  
    5656                        config.Load(); 
    5757 
    58                         cpuHistory = new CPUUsage[60]; 
     58                        cpuHistory = new CPUUsage[61]; 
    5959                        cpuHistoryCount = 0; 
    6060                        cpuHistoryHead = 0; 
    6161 
    62                         memHistory = new MemoryUsage[60]; 
     62                        memHistory = new MemoryUsage[61]; 
    6363                        memHistoryCount = 0; 
    6464                        memHistoryHead = 0; 
     
    115115                        statusWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 
    116116                        statusWindow.ControlBox = false; 
     117                        statusWindow.MaximizeBox = false; 
     118                        statusWindow.MinimizeBox = false; 
    117119                        statusWindow.Icon = new Icon(asm.GetManifestResourceStream("MacFace.FloatApp.App.ico")); 
    118120                        statusWindow.Text = "�X�e�[�^�X"; 
     
    383385                        Graphics g = Graphics.FromImage(memoryGraph); 
    384386 
     387                        int totalMemory = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024; 
     388                        double rate = 100.0 / MemoryUsageCounter.CommitLimit; 
     389                        int border = (int)(totalMemory * rate); 
     390 
    385391                        g.FillRectangle(new SolidBrush(Color.White), 0, 0, 300, 100); 
    386392                        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))  
    388394                        { 
    389395                                g.DrawLine(pen, 0, y, 300, y); 
    390396                        } 
    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; 
    395397 
    396398                        g.SmoothingMode = SmoothingMode.None; 
    397399                        Brush commitedBrush = new SolidBrush(Color.FromArgb(180, 255, 145, 0)); 
    398400                        Brush uncommitedBrush = new SolidBrush(Color.FromArgb(180, 180, 200, 255)); 
    399                         Brush availableBrush = new SolidBrush(Color.FromArgb(180, 100, 100, 255)); 
    400                         Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 255, 255, 100)); 
     401                        Brush availableBrush = new SolidBrush(Color.FromArgb(100, 100, 100, 255)); 
     402                        Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255)); 
    401403 
    402404                        int pos = memHistoryHead - 1; 
     
    411413                                w = 5; 
    412414 
    413                                 h = 30
     415                                h = 100 - border
    414416                                y = 0; 
    415417                                g.FillRectangle(spaceBrush, x, y, w, h); 
     
    419421                                g.FillRectangle(commitedBrush, x, y, w, h); 
    420422 
    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
    425427                                        g.FillRectangle(uncommitedBrush, x, y, w, h); 
    426428                                } 
    427429 
    428430                                h = (int)(usage.Available * rate); 
    429                                 y = 100-70
     431                                y = 100 - border
    430432                                g.FillRectangle(availableBrush, x, y, w, h); 
    431433 
     
    444446                                pos--; 
    445447                        } 
    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); 
    447451 
    448452                        g.Dispose(); 
  • trunk/MacFaceLibrary/MemoryUsageCounter.cs

    r47 r53  
    1313        { 
    1414                private static ulong totalVisibleMemorySize; 
     15                private static PerformanceCounter commitLimitCounter; 
    1516                 
    1617                private PerformanceCounter availableCounter; 
     
    2728                                totalVisibleMemorySize = (ulong)mo["TotalVisibleMemorySize"]; 
    2829                        } 
     30 
     31                        commitLimitCounter = new PerformanceCounter(); 
     32                        commitLimitCounter.CategoryName = "Memory"; 
     33                        commitLimitCounter.CounterName = "Commit Limit"; 
    2934                } 
    3035 
     
    6267                        get { return totalVisibleMemorySize; } 
    6368                } 
     69 
     70                public static ulong CommitLimit  
     71                { 
     72                        get { return (ulong)commitLimitCounter.NextValue(); } 
     73                } 
    6474        } 
    6575}