Partager via


CounterSample Constructeurs

Définition

Initialise une nouvelle instance de la structure CounterSample.

Surcharges

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

Initialise une nouvelle instance de la structure CounterSample et affecte à la propriété CounterTimeStamp la valeur 0 (zéro).

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

Initialise une nouvelle instance de la structure CounterSample et affecte à la propriété CounterTimeStamp la valeur qui est passée.

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

Source:
CounterSample.cs
Source:
CounterSample.cs
Source:
CounterSample.cs

Initialise une nouvelle instance de la structure CounterSample et affecte à la propriété CounterTimeStamp la valeur 0 (zéro).

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)

Paramètres

rawValue
Int64

Valeur numérique associée à l'échantillon de compteur de performance.

baseValue
Int64

Valeur brute de base facultative pour le compteur, à n'utiliser que si l'échantillon est basé sur plusieurs compteurs.

counterFrequency
Int64

Fréquence à laquelle le compteur est lu.

systemFrequency
Int64

Fréquence à laquelle le système lit le compteur.

timeStamp
Int64

Horodatage brut.

timeStamp100nSec
Int64

Horodatage brut haute-fidélité.

counterType
PerformanceCounterType

Objet PerformanceCounterType qui indique le type du compteur dont cet échantillon est un instantané.

Remarques

Utilisez ce constructeur pour prendre un échantillon initial du compteur de performances. Le Moniteur système fournit automatiquement des valeurs pour ces paramètres lorsque vous appelez la NextSample méthode pour la première fois.

S’applique à

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

Source:
CounterSample.cs
Source:
CounterSample.cs
Source:
CounterSample.cs

Initialise une nouvelle instance de la structure CounterSample et affecte à la propriété CounterTimeStamp la valeur qui est passée.

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)

Paramètres

rawValue
Int64

Valeur numérique associée à l'échantillon de compteur de performance.

baseValue
Int64

Valeur brute de base facultative pour le compteur, à n'utiliser que si l'échantillon est basé sur plusieurs compteurs.

counterFrequency
Int64

Fréquence à laquelle le compteur est lu.

systemFrequency
Int64

Fréquence à laquelle le système lit le compteur.

timeStamp
Int64

Horodatage brut.

timeStamp100nSec
Int64

Horodatage brut haute-fidélité.

counterType
PerformanceCounterType

Objet PerformanceCounterType qui indique le type du compteur dont cet échantillon est un instantané.

counterTimeStamp
Int64

Heure à laquelle l'échantillon a été pris.

Exemples

L’exemple suivant montre comment initialiser une nouvelle CounterSample structure, en transmettant des valeurs pour les rawValueparamètres , baseValue, counterFrequency, counterTypetimeStamp100nSecsystemFrequencytimeStampet .counterTimeStamp Après avoir créé la CounterSample structure, l’exemple affiche les valeurs de propriété pour dans CounterSample la fenêtre de console.

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)

Remarques

Utilisez ce constructeur pour prendre des exemples une fois que vous avez déjà prélevé un échantillon initial du compteur de performances. Le Moniteur système fournit automatiquement des valeurs pour ces paramètres lorsque vous appelez la NextSample méthode.

S’applique à