Esporta (0) Stampa
Espandi tutto

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

Inizializza una nuova istanza della struttura CounterSample e imposta la proprietà CounterTimeStamp sul valore passato.

Spazio dei nomi: System.Diagnostics
Assembly: System (in system.dll)

public CounterSample (
	long rawValue,
	long baseValue,
	long counterFrequency,
	long systemFrequency,
	long timeStamp,
	long timeStamp100nSec,
	PerformanceCounterType counterType,
	long counterTimeStamp
)
public CounterSample (
	long rawValue, 
	long baseValue, 
	long counterFrequency, 
	long systemFrequency, 
	long timeStamp, 
	long timeStamp100nSec, 
	PerformanceCounterType counterType, 
	long counterTimeStamp
)
public function CounterSample (
	rawValue : long, 
	baseValue : long, 
	counterFrequency : long, 
	systemFrequency : long, 
	timeStamp : long, 
	timeStamp100nSec : long, 
	counterType : PerformanceCounterType, 
	counterTimeStamp : long
)
Non applicabile.

Parametri

rawValue

Valore numerico associato al campione del contatore delle prestazioni.

baseValue

Valore base facoltativo non elaborato del contatore, da utilizzare soltanto se il campione si basa su più contatori.

counterFrequency

Frequenza con la quale viene letto il contatore.

systemFrequency

Frequenza con la quale il sistema legge il contatore.

timeStamp

Timestamp non elaborato.

timeStamp100nSec

Timestamp ad alta fedeltà non elaborato.

counterType

Oggetto PerformanceCounterType che indica il tipo di contatore di cui questo campione è una vista statica.

counterTimeStamp

Ora in cui è stato ottenuto il campione.

Utilizzare questo costruttore per ottenere altri campioni dopo il campione iniziale del contatore delle prestazioni. Il Monitor di sistema fornisce automaticamente i valori di questi parametri quando si chiama il metodo NextSample.

      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);
...

      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);

        PerformanceCounter myPerformanceCounter1 = new PerformanceCounter(
            "Processor", "% Processor Time", "0");
        CounterSample myCounterSample1 = new CounterSample(10L, 20L, 30L, 40L, 
            50L, 60L, PerformanceCounterType.AverageCount64);
        Console.WriteLine("CounterTimeStamp = " 
            + myCounterSample1.get_CounterTimeStamp());

        Console.WriteLine("BaseValue = " + myCounterSample1.get_BaseValue());
        Console.WriteLine("RawValue = " + myCounterSample1.get_RawValue());
        Console.WriteLine("CounterFrequency = " 
            + myCounterSample1.get_CounterFrequency());
        Console.WriteLine("SystemFrequency = " 
            + myCounterSample1.get_SystemFrequency());
        Console.WriteLine("TimeStamp = " + myCounterSample1.get_TimeStamp());
        Console.WriteLine("TimeStamp100nSec = " 
            + myCounterSample1.get_TimeStamp100nSec());
        Console.WriteLine("CounterType = " 
            + myCounterSample1.get_CounterType());
        // Hold the results of sample.
        myCounterSample1 = myPerformanceCounter1.NextSample();
        Console.WriteLine("BaseValue = " + myCounterSample1.get_BaseValue());
        Console.WriteLine("RawValue = " + myCounterSample1.get_RawValue());
        Console.WriteLine("CounterFrequency = " 
            + myCounterSample1.get_CounterFrequency());
        Console.WriteLine("SystemFrequency = " 
            + myCounterSample1.get_SystemFrequency());
        Console.WriteLine("TimeStamp = " 
            + myCounterSample1.get_TimeStamp());
        Console.WriteLine("TimeStamp100nSec = " 
            + myCounterSample1.get_TimeStamp100nSec());
        Console.WriteLine("CounterType = " 
            + myCounterSample1.get_CounterType());
...

        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.get_CounterTimeStamp());
        Console.WriteLine("BaseValue = " + myCounterSample2.get_BaseValue());
        Console.WriteLine("RawValue = " + myCounterSample2.get_RawValue());
        Console.WriteLine("CounterFrequency = " 
            + myCounterSample2.get_CounterFrequency());
        Console.WriteLine("SystemFrequency = " 
            + myCounterSample2.get_SystemFrequency());
        Console.WriteLine("TimeStamp = " + myCounterSample2.get_TimeStamp());
        Console.WriteLine("TimeStamp100nSec = " 
            + myCounterSample2.get_TimeStamp100nSec());
        Console.WriteLine("CounterType = " 
            + myCounterSample2.get_CounterType());
        Console.WriteLine("CounterTimeStamp = " 
            + myCounterSample2.get_CounterTimeStamp());
        // Hold the results of sample.
        myCounterSample2 = myPerformanceCounter2.NextSample();
        Console.WriteLine("BaseValue = " + myCounterSample2.get_BaseValue());
        Console.WriteLine("RawValue = " + myCounterSample2.get_RawValue());
        Console.WriteLine("CounterFrequency = " 
            + myCounterSample2.get_CounterFrequency());
        Console.WriteLine("SystemFrequency = " 
            + myCounterSample2.get_SystemFrequency());
        Console.WriteLine("TimeStamp = " + myCounterSample2.get_TimeStamp());
        Console.WriteLine("TimeStamp100nSec = " 
            + myCounterSample2.get_TimeStamp100nSec());
        Console.WriteLine("CounterType = " 
            + myCounterSample2.get_CounterType());
        Console.WriteLine("CounterTimeStamp = " 
            + myCounterSample2.get_CounterTimeStamp());

Windows 98, Windows Server 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

Microsoft .NET Framework 3.0 è supportato in Windows Vista, Microsoft Windows XP SP2 e Windows Server 2003 SP1.

.NET Framework

Supportato in:

Aggiunte alla community

AGGIUNGI
Mostra:
© 2015 Microsoft