Ignore:
Timestamp:
Dec 25, 2004, 6:43:07 PM (19 years ago)
Author:
altba\rryu
Message:

パフォーマンスカウンター系のクラスの実装を追加した。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MacFaceLibrary/MemoryUsageCounter.cs

    r24 r25  
    33 */
    44using System;
     5using System.Diagnostics;
    56
    67namespace MacFace
     
    1112        public class MemoryUsageCounter
    1213        {
     14                private PerformanceCounter availableCounter;
     15                private PerformanceCounter committedCounter;
     16                private PerformanceCounter pageoutCounter;
     17                private PerformanceCounter pageinCounter;
     18
    1319                public MemoryUsageCounter()
    1420                {
    15                         //
    16                         // TODO: ƒRƒ“ƒXƒgƒ‰ƒNƒ^ ƒƒWƒbƒN‚ð‚±‚±‚ɒljÁ‚µ‚Ä‚­‚¾‚³‚¢B
    17                         //
     21                        availableCounter = new PerformanceCounter();
     22                        availableCounter.CategoryName = "Memory";
     23                        availableCounter.CounterName = "Available Bytes";
     24
     25                        committedCounter = new PerformanceCounter();
     26                        committedCounter.CategoryName = "Memory";
     27                        committedCounter.CounterName = "Committed Bytes";
     28
     29                        pageoutCounter = new PerformanceCounter();
     30                        pageoutCounter.CategoryName = "Memory";
     31                        pageoutCounter.CounterName = "Pages Output/sec";
     32
     33                        pageinCounter = new PerformanceCounter();
     34                        pageinCounter.CategoryName = "Memory";
     35                        pageinCounter.CounterName = "Pages Input/sec";
     36                }
     37
     38                public MemoryUsage CurrentUsage()
     39                {
     40                        int available = (int)availableCounter.NextValue();
     41                        int committed = (int)committedCounter.NextValue();
     42                        int pagein      = (int)pageinCounter.NextValue();
     43                        int pageout   = (int)pageoutCounter.NextValue();
     44
     45                        return new MemoryUsage(available, committed, pagein, pageout);
    1846                }
    1947        }
Note: See TracChangeset for help on using the changeset viewer.