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