Changeset 57

Show
Ignore:
Timestamp:
06/27/05 21:38:59 (4 years ago)
Author:
rryu
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 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) 
     
    119121                public void StartApplication() 
    120122                { 
     123                        doExit = false; 
     124 
    121125                        // ���^�[���ǂݍ��� 
    122126                        bool result = false; 
     
    154158 
    155159                        Application.ApplicationExit += new EventHandler(Application_ApplicationExit); 
     160                        Microsoft.Win32.SystemEvents.SessionEnding += new Microsoft.Win32.SessionEndingEventHandler(SystemEvents_SessionEnding); 
    156161                        Application.Run(this); 
    157162                } 
     
    399404 
    400405                        g.SmoothingMode = SmoothingMode.None; 
     406                        Brush availableBrush = new SolidBrush(Color.FromArgb(180, 100, 100, 255)); 
     407                        Brush kernelBrush = new SolidBrush(Color.FromArgb(180, 255, 0, 0)); 
    401408                        Brush commitedBrush = new SolidBrush(Color.FromArgb(180, 255, 145, 0)); 
    402                         Brush uncommitedBrush = new SolidBrush(Color.FromArgb(180, 180, 200, 255)); 
    403                        Brush availableBrush = new SolidBrush(Color.FromArgb(180, 100, 100, 255)); 
    404                         Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255)); 
     409                        Brush systemCacheBrush = new SolidBrush(Color.FromArgb(50, 255, 0, 0)); 
     410//                     Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255)); 
     411                        Brush spaceBrush = new SolidBrush(Color.FromArgb(100, 100, 100, 255)); 
    405412 
    406413                        int pos = memHistoryHead - 1; 
     
    410417                                MemoryUsage usage = memHistory[pos]; 
    411418 
    412                                 int x, y, w, h; 
    413  
    414                                 x = 300 - i * 5 - 5; 
    415                                 w = 5; 
    416  
    417                                 h = (int)(usage.Available * rate); 
    418                                 y = 100 - h; 
    419                                 g.FillRectangle(availableBrush, x, y, w, h); 
     419                                int x = 300 - i * 5 - 5; 
     420                                int y = 100; 
     421                                int w = 5; 
     422                                int h = 0; 
     423 
     424                                int kernelTotal = usage.KernelNonPaged + usage.KernelPaged + usage.DriverTotal + usage.SystemCodeTotal; 
     425                                h = (int)((kernelTotal) * rate); 
     426                                y -= h; 
     427                                g.FillRectangle(kernelBrush, x, y, w, h); 
     428 
     429                                h = (int)(usage.SystemCache * rate); 
     430                                y -= h; 
     431                                g.FillRectangle(systemCacheBrush, x, y, w, h); 
    420432 
    421433                                h = (int)(usage.Committed * rate); 
     
    423435                                g.FillRectangle(commitedBrush, x, y, w, h); 
    424436 
    425                                 if (y > 100 - border)  
    426                                 { 
    427                                         h = y - (100 - border); 
    428                                         y = 100 - border; 
    429                                         g.FillRectangle(uncommitedBrush, x, y, w, h); 
    430                                 } 
     437                                h = (int)(usage.Available * rate); 
     438                                y -= h; 
     439                                g.FillRectangle(availableBrush, x, y, w, h); 
    431440 
    432441                                h = y; 
    433442                                y = 0; 
    434443                                g.FillRectangle(spaceBrush, x, y, w, h); 
     444 
    435445 
    436446                                x = 300 - i * 5 - 5; 
     
    457467                private void patternWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) 
    458468                { 
    459                         if (!System.Environment.HasShutdownStarted
     469                        if (!doExit
    460470                        { 
    461471                                e.Cancel = true; 
    462472                        } 
     473                } 
     474 
     475                private void SystemEvents_SessionEnding(object sender, Microsoft.Win32.SessionEndingEventArgs e) 
     476                { 
     477                        doExit = true; 
     478                        updateTimer.Stop(); 
     479                        patternWindow.Close(); 
     480                        statusWindow.Close(); 
     481                        ExitThread(); 
    463482                } 
    464483        } 
  • 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