Changeset 20


Ignore:
Timestamp:
Nov 17, 2004, 9:55:59 PM (19 years ago)
Author:
altba\rryu
Message:

ページI/O表示機能を追加した。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MacFaceFloat/MainForm.cs

    r19 r20  
    3333                Int32 prevUsage;
    3434                PerformanceCounter cpuCount;
    35 //              PerformanceCounter pageoutCount;
    36 //              PerformanceCounter pageinCount;
     35                PerformanceCounter pageoutCount;
     36                PerformanceCounter pageinCount;
    3737
    3838                // ƒRƒ“ƒXƒgƒ‰ƒNƒ^
     
    5050                        cpuCount.InstanceName = "_Total";
    5151
    52 //                      pageoutCount = new PerformanceCounter();
    53 //                      pageoutCount.CategoryName = "Memory";
    54 //                      pageoutCount.CounterName  = "Pages Output/sec";
    55 //
    56 //                      pageinCount = new PerformanceCounter();
    57 //                      pageinCount.CategoryName = "Memory";
    58 //                      pageinCount.CounterName  = "Pages Input/sec";
     52                        pageoutCount = new PerformanceCounter();
     53                        pageoutCount.CategoryName = "Memory";
     54                        pageoutCount.CounterName  = "Pages Output/sec";
     55
     56                        pageinCount = new PerformanceCounter();
     57                        pageinCount.CategoryName = "Memory";
     58                        pageinCount.CounterName  = "Pages Input/sec";
    5959
    6060                        _updateTimer = new System.Windows.Forms.Timer();
     
    199199                public void CountProcessorUsage(object sender, EventArgs e)
    200200                {
    201                         Int32 usage = (Int32)cpuCount.NextValue();
    202 //                      Int32 pagein = (Int32)pageinCount.NextValue();
    203 //                      Int32 pageout = (Int32)pageoutCount.NextValue();
    204 
    205 //                              Console.WriteLine("Processor: {0}% (pattern: {1}) {2} {3}", usage, usage/10, pagein, pageout);
    206                         if (usage >= 100) {
    207                                 usage = 100;
     201                        int usage = (int)cpuCount.NextValue();
     202                        int pagein = (int)pageinCount.NextValue();
     203                        int pageout = (int)pageoutCount.NextValue();
     204
     205                        usage /= 10;
     206                        if (usage > 10) {
     207                                usage = 10;
    208208                        } else if (usage < 0) {
    209209                                usage = 0;
    210210                        }
    211                                
    212                         if (prevUsage/10 != usage/10) {
     211
     212                        int markers = FaceDef.MarkerNone;
     213                        if (pagein > 0) markers += FaceDef.MarkerPageIn;
     214                        if (pageout > 0) markers += FaceDef.MarkerPageOut;
     215
     216                        if (prevUsage != usage)
     217                        {
    213218                                Graphics g = this.Graphics;
    214219                                g.Clear(Color.FromArgb(0, 0, 0, 0));
    215                                 _currentFaceDef.DrawPatternImage(g, FaceDef.PatternSuite.Normal, usage/10, FaceDef.MarkerNone);
     220                                _currentFaceDef.DrawPatternImage(g, FaceDef.PatternSuite.Normal, usage, markers);
    216221                                this.Update();
    217222                        }
Note: See TracChangeset for help on using the changeset viewer.