SuspendProfile メソッドは、指定されたプロファイル レベルの保留/再開カウンターをインクリメントします。
名前空間: Microsoft.VisualStudio.Profiler
アセンブリ: Microsoft.VisualStudio.Profiler (Microsoft.VisualStudio.Profiler.dll 内)
構文
'宣言
Public Shared Function SuspendProfile ( _
profileLevel As ProfileLevel, _
elementId As UInteger _
) As ProfileOperationResult
public static ProfileOperationResult SuspendProfile(
ProfileLevel profileLevel,
uint elementId
)
public:
static ProfileOperationResult SuspendProfile(
ProfileLevel profileLevel,
unsigned int elementId
)
static member SuspendProfile :
profileLevel:ProfileLevel *
elementId:uint32 -> ProfileOperationResult
public static function SuspendProfile(
profileLevel : ProfileLevel,
elementId : uint
) : ProfileOperationResult
パラメーター
- profileLevel
型: Microsoft.VisualStudio.Profiler.ProfileLevel
elementId で指定された ID の実行レベルを指定します。
- elementId
型: System.UInt32
システムによって生成される、プロセスまたはスレッドの ID。
戻り値
型: Microsoft.VisualStudio.Profiler.ProfileOperationResult
戻り値の ProfileOperationResult は列挙型です。
解説
SuspendProfile および ResumeProfile によって、プロファイル レベルにおける保留/再開カウンターを制御します。 通常、保留/再開カウンターはプロファイラー API の標準のデータ制御関数をオーバーライドするために使用されます。
保留/再開カウンターの初期値は 0 です。 SuspendProfile を呼び出すたびに、保留/再開数に 1 が加算されます。ResumeProfile を呼び出すたびに、1 が減算されます。
保留/再開数が 0 よりも大きい場合、そのレベルの保留/再開状態はオフになります。 保留/再開数が 0 以下の場合、保留/再開状態はオンになります。
開始/停止状態と保留/再開状態の両方がオンの場合、そのレベルのプロファイル状態はオンです。 プロファイルの対象となるスレッドでは、グローバル レベル状態、プロセス レベル状態、スレッド レベル状態がすべてオンである必要があります。
例
次に SuspendProfile メソッドの例を示します。 この例では、DataCollection.CurrentId プロパティで識別されるプロセスまたはスレッドに対し、StartProfile が既に呼び出されていることを前提としています。
public void ExerciseSuspendProfile()
{
// The initial value of the Suspend/Resume counter is 0.
// Each call to SuspendProfile adds 1 to the
// Suspend/Resume count; each call
// to ResumeProfile subtracts 1.
// Declare enumeration to hold result of call
// to SuspendProfile
ProfileOperationResult profileResult;
profileResult = DataCollection.SuspendProfile(
ProfileLevel.Global,
DataCollection.CurrentId);
Console.WriteLine("SuspendProfile returned {0}", profileResult);
}
.NET Framework セキュリティ
- 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。