CounterSample コンストラクター

定義

CounterSample 構造体の新しいインスタンスを初期化します。Initializes a new instance of the CounterSample structure.

オーバーロード

CounterSample(Int64, Int64, Int64, Int64, Int64, Int64, PerformanceCounterType)

CounterSample 構造体の新しいインスタンスを初期化し、CounterTimeStamp プロパティを 0 (ゼロ) に設定します。Initializes a new instance of the CounterSample structure and sets the CounterTimeStamp property to 0 (zero).

CounterSample(Int64, Int64, Int64, Int64, Int64, Int64, PerformanceCounterType, Int64)

CounterSample 構造体の新しいインスタンスを初期化し、CounterTimeStamp プロパティを渡された値に設定します。Initializes a new instance of the CounterSample structure and sets the CounterTimeStamp property to the value that is passed in.

CounterSample(Int64, Int64, Int64, Int64, Int64, Int64, PerformanceCounterType)

CounterSample 構造体の新しいインスタンスを初期化し、CounterTimeStamp プロパティを 0 (ゼロ) に設定します。Initializes a new instance of the CounterSample structure and sets the CounterTimeStamp property to 0 (zero).

public:
 CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System::Diagnostics::PerformanceCounterType counterType);
public CounterSample (long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType);
new System.Diagnostics.CounterSample : int64 * int64 * int64 * int64 * int64 * int64 * System.Diagnostics.PerformanceCounterType -> System.Diagnostics.CounterSample
Public Sub New (rawValue As Long, baseValue As Long, counterFrequency As Long, systemFrequency As Long, timeStamp As Long, timeStamp100nSec As Long, counterType As PerformanceCounterType)

パラメーター

rawValue
Int64

パフォーマンス カウンターのサンプルに関連付けられている数値。The numeric value associated with the performance counter sample.

baseValue
Int64

サンプルが複数のカウンターに基づいている場合にだけ使用されるカウンターの生のベース値。省略できます。An optional, base raw value for the counter, to use only if the sample is based on multiple counters.

counterFrequency
Int64

カウンターを読み取る頻度。The frequency with which the counter is read.

systemFrequency
Int64

システムがカウンターを読み取る頻度。The frequency with which the system reads from the counter.

timeStamp
Int64

生のタイム スタンプ。The raw time stamp.

timeStamp100nSec
Int64

信頼性の高い生のタイム スタンプ。The raw, high-fidelity time stamp.

counterType
PerformanceCounterType

このサンプルがスナップショットになるカウンターの種類を示す PerformanceCounterType オブジェクト。A PerformanceCounterType object that indicates the type of the counter for which this sample is a snapshot.

注釈

このコンストラクターを使用して、パフォーマンスカウンターの最初のサンプルを取得します。Use this constructor to take an initial sample of the performance counter. システムモニターは、メソッドを初めて呼び出すときに、これらのパラメーターの値を自動的に提供し NextSample ます。The System Monitor supplies values for these parameters automatically when you call the NextSample method for the first time.

CounterSample(Int64, Int64, Int64, Int64, Int64, Int64, PerformanceCounterType, Int64)

CounterSample 構造体の新しいインスタンスを初期化し、CounterTimeStamp プロパティを渡された値に設定します。Initializes a new instance of the CounterSample structure and sets the CounterTimeStamp property to the value that is passed in.

public:
 CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System::Diagnostics::PerformanceCounterType counterType, long counterTimeStamp);
public CounterSample (long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType, long counterTimeStamp);
new System.Diagnostics.CounterSample : int64 * int64 * int64 * int64 * int64 * int64 * System.Diagnostics.PerformanceCounterType * int64 -> System.Diagnostics.CounterSample
Public Sub New (rawValue As Long, baseValue As Long, counterFrequency As Long, systemFrequency As Long, timeStamp As Long, timeStamp100nSec As Long, counterType As PerformanceCounterType, counterTimeStamp As Long)

パラメーター

rawValue
Int64

パフォーマンス カウンターのサンプルに関連付けられている数値。The numeric value associated with the performance counter sample.

baseValue
Int64

サンプルが複数のカウンターに基づいている場合にだけ使用されるカウンターの生のベース値。省略できます。An optional, base raw value for the counter, to use only if the sample is based on multiple counters.

counterFrequency
Int64

カウンターを読み取る頻度。The frequency with which the counter is read.

systemFrequency
Int64

システムがカウンターを読み取る頻度。The frequency with which the system reads from the counter.

timeStamp
Int64

生のタイム スタンプ。The raw time stamp.

timeStamp100nSec
Int64

信頼性の高い生のタイム スタンプ。The raw, high-fidelity time stamp.

counterType
PerformanceCounterType

このサンプルがスナップショットになるカウンターの種類を示す PerformanceCounterType オブジェクト。A PerformanceCounterType object that indicates the type of the counter for which this sample is a snapshot.

counterTimeStamp
Int64

サンプルを取得した時刻。The time at which the sample was taken.

次の例は、新しい構造体を初期化し、、、、、、、、およびの各パラメーターの値を渡す方法を示して CounterSample rawValue baseValue counterFrequency systemFrequency timeStamp timeStamp100nSec counterType counterTimeStamp います。The following example demonstrates how to initialize a new CounterSample structure, passing in values for the rawValue, baseValue, counterFrequency, systemFrequency, timeStamp, timeStamp100nSec, counterType, and counterTimeStamp parameters. この例では、構造を作成した後、の CounterSample プロパティ値を CounterSample コンソールウィンドウに表示します。After creating the CounterSample structure, the example displays the property values for the CounterSample in the console window.

PerformanceCounter^ myPerformanceCounter1 = gcnew PerformanceCounter(
   "Processor","% Processor Time","0" );
CounterSample myCounterSample1( 10L, 20L, 30L, 40L, 50L, 60L,
  PerformanceCounterType::AverageCount64 );
Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample1.CounterTimeStamp );

Console::WriteLine( "BaseValue = {0}", myCounterSample1.BaseValue );
Console::WriteLine( "RawValue = {0}", myCounterSample1.RawValue );
Console::WriteLine( "CounterFrequency = {0}", myCounterSample1.CounterFrequency );
Console::WriteLine( "SystemFrequency = {0}", myCounterSample1.SystemFrequency );
Console::WriteLine( "TimeStamp = {0}", myCounterSample1.TimeStamp );
Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample1.TimeStamp100nSec );
Console::WriteLine( "CounterType = {0}", myCounterSample1.CounterType );
// Hold the results of sample.
myCounterSample1 = myPerformanceCounter1->NextSample();
Console::WriteLine( "BaseValue = {0}", myCounterSample1.BaseValue );
Console::WriteLine( "RawValue = {0}", myCounterSample1.RawValue );
Console::WriteLine( "CounterFrequency = {0}", myCounterSample1.CounterFrequency );
Console::WriteLine( "SystemFrequency = {0}", myCounterSample1.SystemFrequency );
Console::WriteLine( "TimeStamp = {0}", myCounterSample1.TimeStamp );
Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample1.TimeStamp100nSec );
Console::WriteLine( "CounterType = {0}", myCounterSample1.CounterType );
PerformanceCounter myPerformanceCounter1 = new PerformanceCounter
   ("Processor","% Processor Time", "0");
CounterSample myCounterSample1 = new CounterSample(10L, 20L, 30L, 40L, 50L, 60L,
                     PerformanceCounterType.AverageCount64);
Console.WriteLine("CounterTimeStamp = "+myCounterSample1.CounterTimeStamp);

Console.WriteLine("BaseValue = "+myCounterSample1.BaseValue);
Console.WriteLine("RawValue = "+myCounterSample1.RawValue);
Console.WriteLine("CounterFrequency = "+myCounterSample1.CounterFrequency);
Console.WriteLine("SystemFrequency = "+myCounterSample1.SystemFrequency);
Console.WriteLine("TimeStamp = "+myCounterSample1.TimeStamp);
Console.WriteLine("TimeStamp100nSec = "+myCounterSample1.TimeStamp100nSec);
Console.WriteLine("CounterType = "+myCounterSample1.CounterType);
// Hold the results of sample.
myCounterSample1 = myPerformanceCounter1.NextSample();
Console.WriteLine("BaseValue = "+myCounterSample1.BaseValue);
Console.WriteLine("RawValue = "+myCounterSample1.RawValue);
Console.WriteLine("CounterFrequency = "+myCounterSample1.CounterFrequency);
Console.WriteLine("SystemFrequency = "+myCounterSample1.SystemFrequency);
Console.WriteLine("TimeStamp = "+myCounterSample1.TimeStamp);
Console.WriteLine("TimeStamp100nSec = "+myCounterSample1.TimeStamp100nSec);
Console.WriteLine("CounterType = "+myCounterSample1.CounterType);
Dim myPerformanceCounter1 As New PerformanceCounter("Processor", _
                                            "% Processor Time", "0")
Dim myCounterSample1 As New CounterSample(10&, 20&, 30&, 40&, 50&, 60&, _
                               PerformanceCounterType.AverageCount64)
Console.WriteLine("CounterTimeStamp = " & myCounterSample1.CounterTimeStamp)

Console.WriteLine("BaseValue = " & myCounterSample1.BaseValue)
Console.WriteLine("RawValue = " & myCounterSample1.RawValue)
Console.WriteLine("CounterFrequency = " & myCounterSample1.CounterFrequency)
Console.WriteLine("SystemFrequency = " & myCounterSample1.SystemFrequency)
Console.WriteLine("TimeStamp = " & myCounterSample1.TimeStamp)
Console.WriteLine("TimeStamp100nSec = " & myCounterSample1.TimeStamp100nSec)
Console.WriteLine("CounterType = " & myCounterSample1.CounterType.ToString)
' Hold the results of sample.
myCounterSample1 = myPerformanceCounter1.NextSample()

Console.WriteLine("BaseValue = " & myCounterSample1.BaseValue)
Console.WriteLine("RawValue = " & myCounterSample1.RawValue)
Console.WriteLine("CounterFrequency = " & myCounterSample1.CounterFrequency)
Console.WriteLine("SystemFrequency = " & myCounterSample1.SystemFrequency)
Console.WriteLine("TimeStamp = " & myCounterSample1.TimeStamp)
Console.WriteLine("TimeStamp100nSec = " & myCounterSample1.TimeStamp100nSec)
Console.WriteLine("CounterType = " & myCounterSample1.CounterType.ToString)
PerformanceCounter^ myPerformanceCounter2 =
   gcnew PerformanceCounter( "Processor","% Processor Time","0" );
CounterSample myCounterSample2( 10L, 20L, 30L, 40L, 50L, 60L,
  PerformanceCounterType::AverageCount64,300);
Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp );
Console::WriteLine( "BaseValue = {0}", myCounterSample2.BaseValue );
Console::WriteLine( "RawValue = {0}", myCounterSample2.RawValue );
Console::WriteLine( "CounterFrequency = {0}", myCounterSample2.CounterFrequency );
Console::WriteLine( "SystemFrequency = {0}", myCounterSample2.SystemFrequency );
Console::WriteLine( "TimeStamp = {0}", myCounterSample2.TimeStamp );
Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample2.TimeStamp100nSec );
Console::WriteLine( "CounterType = {0}", myCounterSample2.CounterType );
Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp );
// Hold the results of sample.
myCounterSample2 = myPerformanceCounter2->NextSample();
Console::WriteLine( "BaseValue = {0}", myCounterSample2.BaseValue );
Console::WriteLine( "RawValue = {0}", myCounterSample2.RawValue );
Console::WriteLine( "CounterFrequency = {0}", myCounterSample2.CounterFrequency );
Console::WriteLine( "SystemFrequency = {0}", myCounterSample2.SystemFrequency );
Console::WriteLine( "TimeStamp = {0}", myCounterSample2.TimeStamp );
Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample2.TimeStamp100nSec );
Console::WriteLine( "CounterType = {0}", myCounterSample2.CounterType );
Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp );
PerformanceCounter myPerformanceCounter2 = new PerformanceCounter
   ("Processor","% Processor Time", "0");
CounterSample myCounterSample2 = new CounterSample(10L, 20L, 30L, 40L, 50L, 60L,
               PerformanceCounterType.AverageCount64, 300);
Console.WriteLine("CounterTimeStamp = "+myCounterSample2.CounterTimeStamp);
Console.WriteLine("BaseValue = "+myCounterSample2.BaseValue);
Console.WriteLine("RawValue = "+myCounterSample2.RawValue);
Console.WriteLine("CounterFrequency = "+myCounterSample2.CounterFrequency);
Console.WriteLine("SystemFrequency = "+myCounterSample2.SystemFrequency);
Console.WriteLine("TimeStamp = "+myCounterSample2.TimeStamp);
Console.WriteLine("TimeStamp100nSec = "+myCounterSample2.TimeStamp100nSec);
Console.WriteLine("CounterType = "+myCounterSample2.CounterType);
Console.WriteLine("CounterTimeStamp = "+myCounterSample2.CounterTimeStamp);
// Hold the results of sample.
myCounterSample2 = myPerformanceCounter2.NextSample();
Console.WriteLine("BaseValue = "+myCounterSample2.BaseValue);
Console.WriteLine("RawValue = "+myCounterSample2.RawValue);
Console.WriteLine("CounterFrequency = "+myCounterSample2.CounterFrequency);
Console.WriteLine("SystemFrequency = "+myCounterSample2.SystemFrequency);
Console.WriteLine("TimeStamp = "+myCounterSample2.TimeStamp);
Console.WriteLine("TimeStamp100nSec = "+myCounterSample2.TimeStamp100nSec);
Console.WriteLine("CounterType = "+myCounterSample2.CounterType);
Console.WriteLine("CounterTimeStamp = "+myCounterSample2.CounterTimeStamp);
Dim myPerformanceCounter2 As New PerformanceCounter("Processor", _
                                             "% Processor Time", "0")
Dim myCounterSample2 As New CounterSample(10&, 20&, 30&, 40&, 50&, 60&, _
                         PerformanceCounterType.AverageCount64, 300)
Console.WriteLine("CounterTimeStamp = " & myCounterSample2.CounterTimeStamp)
Console.WriteLine("BaseValue = " & myCounterSample2.BaseValue)
Console.WriteLine("RawValue = " & myCounterSample2.RawValue)
Console.WriteLine("CounterFrequency = " & myCounterSample2.CounterFrequency)
Console.WriteLine("SystemFrequency = " & myCounterSample2.SystemFrequency)
Console.WriteLine("TimeStamp = " & myCounterSample2.TimeStamp)
Console.WriteLine("TimeStamp100nSec = " & myCounterSample2.TimeStamp100nSec)
Console.WriteLine("CounterType = " & myCounterSample2.CounterType.ToString)
Console.WriteLine("CounterTimeStamp = " & myCounterSample2.CounterTimeStamp)

' Hold the results of sample.
myCounterSample2 = myPerformanceCounter2.NextSample()
Console.WriteLine("BaseValue = " & myCounterSample2.BaseValue)
Console.WriteLine("RawValue = " & myCounterSample2.RawValue)
Console.WriteLine("CounterFrequency = " & myCounterSample2.CounterFrequency)
Console.WriteLine("SystemFrequency = " & myCounterSample2.SystemFrequency)
Console.WriteLine("TimeStamp = " & myCounterSample2.TimeStamp)
Console.WriteLine("TimeStamp100nSec = " & myCounterSample2.TimeStamp100nSec)
Console.WriteLine("CounterType = " & myCounterSample2.CounterType.ToString)
Console.WriteLine("CounterTimeStamp = " & myCounterSample2.CounterTimeStamp)

注釈

このコンストラクターを使用して、パフォーマンスカウンターの初期サンプルを既に取得してからサンプルを取得します。Use this constructor to take samples after you have already taken an initial sample of the performance counter. システムモニターは、メソッドを呼び出すと、これらのパラメーターの値を自動的に提供し NextSample ます。The System Monitor supplies values for these parameters automatically when you call the NextSample method.

適用対象