Changeset 53


Ignore:
Timestamp:
Apr 1, 2005, 11:23:55 PM (19 years ago)
Author:
altba\rryu
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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;
     
    116116                        statusWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
    117117                        statusWindow.ControlBox = false;
     118                        statusWindow.MaximizeBox = false;
     119                        statusWindow.MinimizeBox = false;
    118120                        statusWindow.Icon = new Icon(asm.GetManifestResourceStream("MacFace.FloatApp.App.ico"));
    119121                        statusWindow.Text = "ƒXƒe[ƒ^ƒX";
     
    386388                        Graphics g = Graphics.FromImage(memoryGraph);
    387389
     390                        int totalMemory = (int)MemoryUsageCounter.TotalVisibleMemorySize * 1024;
     391                        double rate = 100.0 / MemoryUsageCounter.CommitLimit;
     392                        int border = (int)(totalMemory * rate);
     393
    388394                        g.FillRectangle(new SolidBrush(Color.White), 0, 0, 300, 100);
    389395                        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))
    391397                        {
    392398                                g.DrawLine(pen, 0, y, 300, y);
    393399                        }
    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;
    398400
    399401                        g.SmoothingMode = SmoothingMode.None;
    400402                        Brush commitedBrush = new SolidBrush(Color.FromArgb(180, 255, 145, 0));
    401403                        Brush uncommitedBrush = new SolidBrush(Color.FromArgb(180, 180, 200, 255));
    402                         Brush availableBrush = new SolidBrush(Color.FromArgb(180, 100, 100, 255));
    403                         Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 255, 255, 100));
     404                        Brush availableBrush = new SolidBrush(Color.FromArgb(100, 100, 100, 255));
     405                        Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255));
    404406
    405407                        int pos = memHistoryHead - 1;
     
    414416                                w = 5;
    415417
    416                                 h = 30;
     418                                h = 100 - border;
    417419                                y = 0;
    418420                                g.FillRectangle(spaceBrush, x, y, w, h);
     
    422424                                g.FillRectangle(commitedBrush, x, y, w, h);
    423425
    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;
    428430                                        g.FillRectangle(uncommitedBrush, x, y, w, h);
    429431                                }
    430432
    431433                                h = (int)(usage.Available * rate);
    432                                 y = 100-70;
     434                                y = 100 - border;
    433435                                g.FillRectangle(availableBrush, x, y, w, h);
    434436
     
    447449                                pos--;
    448450                        }
    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);
    450454
    451455                        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}
Note: See TracChangeset for help on using the changeset viewer.