Changeset 57


Ignore:
Timestamp:
Jun 27, 2005, 9:38:59 PM (19 years ago)
Author:
rryu
Message:

ステータスウインドウに以下の項目を表示するようにした。
Cache Bytes
Pool Paged Bytes
Pool Nonpaged Bytes
System Driver Total Bytes
System Code Total Bytes

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MacFaceFloat/MacFaceApp.cs

    r56 r57  
    4444                private int memHistoryCount;
    4545
     46                private bool doExit;
     47
    4648                [STAThread]
    4749                public static void Main(string[] args)
     
    120122                public void StartApplication()
    121123                {
     124                        doExit = false;
     125
    122126                        // Šçƒpƒ^[ƒ““ǂݍž‚Ý
    123127                        bool result = false;
     
    155159
    156160                        Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
     161                        Microsoft.Win32.SystemEvents.SessionEnding += new Microsoft.Win32.SessionEndingEventHandler(SystemEvents_SessionEnding);
    157162                        Application.Run(this);
    158163                }
     
    402407
    403408                        g.SmoothingMode = SmoothingMode.None;
     409                        Brush availableBrush = new SolidBrush(Color.FromArgb(180, 100, 100, 255));
     410                        Brush kernelBrush = new SolidBrush(Color.FromArgb(180, 255, 0, 0));
    404411                        Brush commitedBrush = new SolidBrush(Color.FromArgb(180, 255, 145, 0));
    405                         Brush uncommitedBrush = new SolidBrush(Color.FromArgb(180, 180, 200, 255));
    406                         Brush availableBrush = new SolidBrush(Color.FromArgb(180, 100, 100, 255));
    407                         Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255));
     412                        Brush systemCacheBrush = new SolidBrush(Color.FromArgb(50, 255, 0, 0));
     413//                      Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255));
     414                        Brush spaceBrush = new SolidBrush(Color.FromArgb(100, 100, 100, 255));
    408415
    409416                        int pos = memHistoryHead - 1;
     
    413420                                MemoryUsage usage = memHistory[pos];
    414421
    415                                 int x, y, w, h;
    416 
    417                                 x = 300 - i * 5 - 5;
    418                                 w = 5;
    419 
    420                                 h = (int)(usage.Available * rate);
    421                                 y = 100 - h;
    422                                 g.FillRectangle(availableBrush, x, y, w, h);
     422                                int x = 300 - i * 5 - 5;
     423                                int y = 100;
     424                                int w = 5;
     425                                int h = 0;
     426
     427                                int kernelTotal = usage.KernelNonPaged + usage.KernelPaged + usage.DriverTotal + usage.SystemCodeTotal;
     428                                h = (int)((kernelTotal) * rate);
     429                                y -= h;
     430                                g.FillRectangle(kernelBrush, x, y, w, h);
     431
     432                                h = (int)(usage.SystemCache * rate);
     433                                y -= h;
     434                                g.FillRectangle(systemCacheBrush, x, y, w, h);
    423435
    424436                                h = (int)(usage.Committed * rate);
     
    426438                                g.FillRectangle(commitedBrush, x, y, w, h);
    427439
    428                                 if (y > 100 - border)
    429                                 {
    430                                         h = y - (100 - border);
    431                                         y = 100 - border;
    432                                         g.FillRectangle(uncommitedBrush, x, y, w, h);
    433                                 }
     440                                h = (int)(usage.Available * rate);
     441                                y -= h;
     442                                g.FillRectangle(availableBrush, x, y, w, h);
    434443
    435444                                h = y;
    436445                                y = 0;
    437446                                g.FillRectangle(spaceBrush, x, y, w, h);
     447
    438448
    439449                                x = 300 - i * 5 - 5;
     
    460470                private void patternWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    461471                {
    462                         if (!System.Environment.HasShutdownStarted)
     472                        if (!doExit)
    463473                        {
    464474                                e.Cancel = true;
    465475                        }
     476                }
     477
     478                private void SystemEvents_SessionEnding(object sender, Microsoft.Win32.SessionEndingEventArgs e)
     479                {
     480                        doExit = true;
     481                        updateTimer.Stop();
     482                        patternWindow.Close();
     483                        statusWindow.Close();
     484                        ExitThread();
    466485                }
    467486        }
  • trunk/MacFaceLibrary/MemoryUsage.cs

    r25 r57  
    1515                private int pagein;
    1616                private int pageout;
     17                private int systemCache;
     18                private int kernelPaged;
     19                private int kernelNonPaged;
     20                private int driverTotal;
     21                private int systemCodeTotal;
    1722
    18                 public MemoryUsage(int available, int committed, int pagein, int pageout)
     23                public MemoryUsage(int available, int committed, int pagein, int pageout,
     24                        int systemCache, int kernelPaged, int kernelNonPaged, int driverTotal, int systemCodeTotal)
    1925                {
    2026                        this.available = available;
     
    2228                        this.pagein = pagein;
    2329                        this.pageout = pageout;
     30                        this.systemCache = systemCache;
     31                        this.kernelPaged = kernelPaged;
     32                        this.kernelNonPaged = kernelNonPaged;
     33                        this.driverTotal = driverTotal;
     34                        this.systemCodeTotal = systemCodeTotal;
    2435                }
    2536
     
    4354                        get { return pageout; }
    4455                }
     56
     57                public int SystemCache
     58                {
     59                        get { return systemCache; }
     60                }
     61
     62                public int KernelPaged
     63                {
     64                        get { return kernelPaged; }
     65                }
     66
     67                public int KernelNonPaged
     68                {
     69                        get { return kernelNonPaged; }
     70                }
     71
     72                public int DriverTotal
     73                {
     74                        get { return driverTotal; }
     75                }
     76
     77                public int SystemCodeTotal
     78                {
     79                        get { return systemCodeTotal; }
     80                }
    4581        }
    4682}
  • trunk/MacFaceLibrary/MemoryUsageCounter.cs

    r53 r57  
    1919                private PerformanceCounter pageoutCounter;
    2020                private PerformanceCounter pageinCounter;
     21                private PerformanceCounter systemCacheCounter;
     22                private PerformanceCounter kernelPagedCounter;
     23                private PerformanceCounter kernelNonPagedCounter;
     24                private PerformanceCounter driverTotalCounter;
     25                private PerformanceCounter systemCodeTotalCounter;
    2126
    2227                static MemoryUsageCounter()
     
    5156                        pageinCounter.CategoryName = "Memory";
    5257                        pageinCounter.CounterName = "Pages Input/sec";
     58
     59                        systemCacheCounter = new PerformanceCounter();
     60                        systemCacheCounter.CategoryName = "Memory";
     61                        systemCacheCounter.CounterName = "Cache Bytes";
     62
     63                        kernelPagedCounter = new PerformanceCounter();
     64                        kernelPagedCounter.CategoryName = "Memory";
     65                        kernelPagedCounter.CounterName = "Pool Paged Bytes";
     66
     67                        kernelNonPagedCounter = new PerformanceCounter();
     68                        kernelNonPagedCounter.CategoryName = "Memory";
     69                        kernelNonPagedCounter.CounterName = "Pool Nonpaged Bytes";
     70
     71                        driverTotalCounter = new PerformanceCounter();
     72                        driverTotalCounter.CategoryName = "Memory";
     73                        driverTotalCounter.CounterName = "System Driver Total Bytes";
     74
     75                        systemCodeTotalCounter = new PerformanceCounter();
     76                        systemCodeTotalCounter.CategoryName = "Memory";
     77                        systemCodeTotalCounter.CounterName = "System Code Total Bytes";
    5378                }
    5479
    5580                public MemoryUsage CurrentUsage()
    5681                {
    57                         int available = (int)availableCounter.NextValue();
    58                         int committed = (int)committedCounter.NextValue();
    59                         int pagein      = (int)pageinCounter.NextValue();
    60                         int pageout   = (int)pageoutCounter.NextValue();
     82                        int available      = (int)availableCounter.NextValue();
     83                        int committed      = (int)committedCounter.NextValue();
     84                        int pagein             = (int)pageinCounter.NextValue();
     85                        int pageout        = (int)pageoutCounter.NextValue();
     86                        int systemCache    = (int)systemCacheCounter.NextValue();
     87                        int kernelPaged    = (int)kernelPagedCounter.NextValue();
     88                        int kernelNonPaged = (int)kernelNonPagedCounter.NextValue();
     89                        int driverTotal    = (int)driverTotalCounter.NextValue();
     90                        int systemCodeTotal = (int)systemCodeTotalCounter.NextValue();
    6191
    62                         return new MemoryUsage(available, committed, pagein, pageout);
     92                        return new MemoryUsage(available, committed, pagein, pageout,
     93                                systemCache, kernelPaged, kernelNonPaged, driverTotal, systemCodeTotal);
    6394                }
    6495
Note: See TracChangeset for help on using the changeset viewer.