WebProcessStatistics クラス
アセンブリ: System.Web (system.web.dll 内)


運用および操作の担当者は、ASP.NET Health Monitoring を使用して、配置されている Web アプリケーションを管理できます。System.Web.Management 名前空間には、アプリケーションの状態データをパッケージ化する状態イベント型、およびそのデータを処理するプロバイダ型が含まれます。また、状態イベント管理を支援するサポート型も含まれます。
WebProcessStatistics クラスのインスタンスには、WebHeartBeatEvent 型を使用して取得される情報が格納されます。
![]() |
---|
ほとんどの場合、ASP.NET 状態監視型は実装のまま使用でき、healthMonitoring 構成セクションに値を指定して ASP.NET Health Monitoring system を制御できます。状態監視型の派生として独自のイベントおよびプロバイダを作成することもできます。カスタム イベント クラスの作成例については、このトピックの例を参照してください。
|
次に、ASP.NET でプロセスの統計情報を含むパルス イベントをログに記録する場合に使用できる構成ファイルの抜粋を示します。

次のコードは、2 つの部分で構成されます。最初は、ASP.NET で WebProcessStatistics 型のカスタム イベントを使用できるようにする構成ファイルの抜粋です。次は、このカスタム イベントの実装方法です。
作成したカスタム イベントが適切なタイミングで発生すること、つまり、置き換える対象のシステム状態イベントと同じタイミングで発生することを確認してください。
<healthMonitoring enabled="true" heartBeatInterval="0"> <eventMappings> <add name="SampleProcessStatistics" type="SamplesAspNet.SampleWebProcessStatistics, webprocessstatistics, Version=1.0.1585.27289, Culture=neutral, PublicKeyToken=3648e5c763a8239f, processorArchitecture=MSIL"/> </eventMappings> <rules> <add name="Custom Process Statistics" eventName="SampleProcessStatistics" provider="EventLogProvider" profile="Default"/> </rules> </healthMonitoring>
Imports System Imports System.Text Imports System.Web Imports System.Web.Management ' Implements a custom WebBaseEvent type that ' uses the WebProcessStatistics. Public Class SampleWebProcessStatistics Inherits WebBaseEvent Private eventInfo As StringBuilder Private Shared processStatistics As WebProcessStatistics ' Instantiate the SampleWebProcessStatistics ' type. Public Sub New(ByVal msg As String, ByVal eventSource As Object, ByVal eventCode As Integer) MyBase.New(msg, eventSource, eventCode) ' Perform custom initialization. Dim customMsg As String = String.Format("Event created at: {0}", EventTime.ToString()) eventInfo = New StringBuilder() eventInfo.AppendLine(customMsg) ' Instantiate the WebProcessStatistics ' type. processStatistics = New WebProcessStatistics() End Sub 'New ' Raises the event. Public Overrides Sub Raise() ' Perform custom processing. eventInfo.Append(String.Format( _ "Event raised at: {0}" + _ ControlChars.Lf, EventTime.ToString())) ' Raise the event. MyBase.Raise() End Sub 'Raise Public Function GetAppDomainCount() As String ' Get the app domain count. Return String.Format( _ "Application domain count: {0}", _ processStatistics.AppDomainCount.ToString()) End Function 'GetAppDomainCount Public Function GetManagedHeapSize() As String ' Get the mamaged heap size. Return String.Format( _ "Managed heap size: {0}", _ processStatistics.ManagedHeapSize.ToString()) End Function 'GetManagedHeapSize Public Function GetPeakWorkingSet() As String ' Get the peak working set. Return String.Format( _ "Peak working set: {0}", _ processStatistics.PeakWorkingSet.ToString()) End Function 'GetPeakWorkingSet Public Function GetProcessStartTime() As String ' Get the process start time. Return String.Format( _ "Process start time: {0}", _ processStatistics.ProcessStartTime.ToString()) End Function 'GetProcessStartTime Public Function GetRequestsExecuting() As String ' Get the requests in execution. Return String.Format( _ "Requests executing: {0}", _ processStatistics.RequestsExecuting.ToString()) End Function 'GetRequestsExecuting Public Function GetRequestsQueued() As String ' Get the requests queued. Return String.Format( _ "Requests queued: {0}", _ processStatistics.RequestsQueued.ToString()) End Function 'GetRequestsQueued Public Function GetRequestsRejected() As String ' Get the requests rejected. Return String.Format( _ "Requests rejected: {0}", _ processStatistics.RequestsRejected.ToString()) End Function 'GetRequestsRejected Public Function GetThreadCount() As String ' Get the thread count. Return String.Format( _ "Thread count: {0}", _ processStatistics.ThreadCount.ToString()) End Function 'GetThreadCount Public Function GetWorkingSet() As String ' Get the working set. Return String.Format( _ "Working set: {0}", _ processStatistics.WorkingSet.ToString()) End Function 'GetWorkingSet 'Formats Web request event information. Public Overrides Sub FormatCustomEventDetails( _ ByVal formatter As WebEventFormatter) MyBase.FormatCustomEventDetails(formatter) ' Add custom data. formatter.AppendLine("") formatter.AppendLine("Custom Process Statistics:") formatter.IndentationLevel += 1 ' Get the process statistics. formatter.AppendLine(GetAppDomainCount()) formatter.AppendLine(GetManagedHeapSize()) formatter.AppendLine(GetPeakWorkingSet()) formatter.AppendLine(GetProcessStartTime()) formatter.AppendLine(GetRequestsExecuting()) formatter.AppendLine(GetRequestsQueued()) formatter.AppendLine(GetRequestsRejected()) formatter.AppendLine(GetThreadCount()) formatter.AppendLine(GetWorkingSet()) formatter.IndentationLevel -= 1 formatter.AppendLine(eventInfo.ToString()) End Sub 'FormatCustomEventDetails End Class 'SampleWebEventHelper
using System; using System.Text; using System.Web; using System.Web.Management; namespace SamplesAspNet { // Implements a custom WebBaseEvent type that // uses the WebProcessStatistics. public class SampleWebProcessStatistics : WebBaseEvent { private StringBuilder eventInfo; private static WebProcessStatistics processStatistics; // Instantiate the SampleWebProcessStatistics // type. public SampleWebProcessStatistics(string msg, object eventSource, int eventCode): base(msg, eventSource, eventCode) { // Perform custom initialization. string customMsg = string.Format("Event created at: {0}", EventTime.ToString()); eventInfo = new StringBuilder(); eventInfo.AppendLine(customMsg); // Instantiate the WebProcessStatistics // type. processStatistics = new WebProcessStatistics(); } // Raises the event. public override void Raise() { // Perform custom processing. eventInfo.Append( string.Format( "Event raised at: {0}\n", EventTime.ToString())); // Raise the event. base.Raise(); } public string GetAppDomainCount() { // Get the app domain count. return (string.Format( "Application domain count: {0}", processStatistics.AppDomainCount.ToString())); } public string GetManagedHeapSize() { // Get the mamaged heap size. return (string.Format( "Managed heap size: {0}", processStatistics.ManagedHeapSize.ToString())); } public string GetPeakWorkingSet() { // Get the peak working set. return (string.Format( "Peak working set: {0}", processStatistics.PeakWorkingSet.ToString())); } public string GetProcessStartTime() { // Get the process start time. return (string.Format( "Process start time: {0}", processStatistics.ProcessStartTime.ToString())); } public string GetRequestsExecuting() { // Get the requests in execution. return (string.Format( "Requests executing: {0}", processStatistics.RequestsExecuting.ToString())); } public string GetRequestsQueued() { // Get the requests queued. return (string.Format( "Requests queued: {0}", processStatistics.RequestsQueued.ToString())); } public string GetRequestsRejected() { // Get the requests rejected. return (string.Format( "Requests rejected: {0}", processStatistics.RequestsRejected.ToString())); } public string GetThreadCount() { // Get the thread count. return (string.Format( "Thread count: {0}", processStatistics.ThreadCount.ToString())); } public string GetWorkingSet() { // Get the working set. return (string.Format( "Working set: {0}", processStatistics.WorkingSet.ToString())); } //Formats Web request event information. public override void FormatCustomEventDetails( WebEventFormatter formatter) { base.FormatCustomEventDetails(formatter); // Add custom data. formatter.AppendLine(""); formatter.AppendLine( "Custom Process Statistics:"); formatter.IndentationLevel += 1; // Get the process statistics. formatter.AppendLine(GetAppDomainCount()); formatter.AppendLine(GetManagedHeapSize()); formatter.AppendLine(GetPeakWorkingSet()); formatter.AppendLine(GetProcessStartTime()); formatter.AppendLine(GetRequestsExecuting()); formatter.AppendLine(GetRequestsQueued()); formatter.AppendLine(GetRequestsRejected()); formatter.AppendLine(GetThreadCount()); formatter.AppendLine(GetWorkingSet()); formatter.IndentationLevel -= 1; formatter.AppendLine(eventInfo.ToString()); } } }

System.Web.Management.WebProcessStatistics


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebProcessStatistics コンストラクタ
アセンブリ: System.Web (system.web.dll 内)


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebProcessStatistics プロパティ

名前 | 説明 | |
---|---|---|
![]() | AppDomainCount | プロセス内のアプリケーション ドメインの数を取得します。 |
![]() | ManagedHeapSize | マネージ ヒープのサイズを取得します。 |
![]() | PeakWorkingSet | プロセスの有効期間における現在までのピーク ワーキング セットを取得します。 |
![]() | ProcessStartTime | プロセスが開始された時刻を取得します。 |
![]() | RequestsExecuting | 現在実行中の要求数を取得します。 |
![]() | RequestsQueued | 処理待ちの要求数を取得します。 |
![]() | RequestsRejected | 拒否された要求数を取得します。 |
![]() | ThreadCount | プロセス スレッド カウントの総数を取得します。 |
![]() | WorkingSet | プロセスのワーキング セットを取得します。 |

WebProcessStatistics メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | FormatToString | プロセスの統計情報を所定の形式にします。 |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

WebProcessStatistics メンバ
WebProcessStatistics データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | WebProcessStatistics |

名前 | 説明 | |
---|---|---|
![]() | AppDomainCount | プロセス内のアプリケーション ドメインの数を取得します。 |
![]() | ManagedHeapSize | マネージ ヒープのサイズを取得します。 |
![]() | PeakWorkingSet | プロセスの有効期間における現在までのピーク ワーキング セットを取得します。 |
![]() | ProcessStartTime | プロセスが開始された時刻を取得します。 |
![]() | RequestsExecuting | 現在実行中の要求数を取得します。 |
![]() | RequestsQueued | 処理待ちの要求数を取得します。 |
![]() | RequestsRejected | 拒否された要求数を取得します。 |
![]() | ThreadCount | プロセス スレッド カウントの総数を取得します。 |
![]() | WorkingSet | プロセスのワーキング セットを取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | FormatToString | プロセスの統計情報を所定の形式にします。 |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からWebProcessStatisticsを検索する場合は、下記のリンクをクリックしてください。

- WebProcessStatisticsのページへのリンク