Stopwatch Class

Tanım

Bir dizi yöntem ve doğru bir şekilde ölçü geçen süre için kullanabileceğiniz özellikler sunar. Provides a set of methods and properties that you can use to accurately measure elapsed time.

public class Stopwatch
Devralma
Stopwatch

Örnekler

Aşağıdaki örnek nasıl kullanılacağını gösterir Stopwatch bir uygulama için yürütme süresini belirlemek için sınıf.The following example demonstrates how to use the Stopwatch class to determine the execution time for an application.

using System;
using System.Diagnostics;
using System.Threading;
class Program
{
    static void Main(string[] args)
    {
        Stopwatch stopWatch = new Stopwatch();
        stopWatch.Start();
        Thread.Sleep(10000);
        stopWatch.Stop();
        // Get the elapsed time as a TimeSpan value.
        TimeSpan ts = stopWatch.Elapsed;

        // Format and display the TimeSpan value.
        string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
            ts.Hours, ts.Minutes, ts.Seconds,
            ts.Milliseconds / 10);
        Console.WriteLine("RunTime " + elapsedTime);
    }
}
Imports System
Imports System.Diagnostics
Imports System.Threading


Class Program

    Shared Sub Main(ByVal args() As String)
        Dim stopWatch As New Stopwatch()
        stopWatch.Start()
        Thread.Sleep(10000)
        stopWatch.Stop()
        ' Get the elapsed time as a TimeSpan value.
        Dim ts As TimeSpan = stopWatch.Elapsed

        ' Format and display the TimeSpan value.
        Dim elapsedTime As String = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10)
        Console.WriteLine( "RunTime " + elapsedTime)

    End Sub 'Main
End Class 'Program

Aşağıdaki örnek, kullanımını gösterir Stopwatch performans verileri hesaplamak için sınıf.The following example demonstrates the use of the Stopwatch class to calculate performance data.

#using <System.dll>

using namespace System;
using namespace System::Diagnostics;

void DisplayTimerProperties()
{
   // Display the timer frequency and resolution.
   if ( Stopwatch::IsHighResolution )
   {
      Console::WriteLine( "Operations timed using the system's high-resolution performance counter." );
   }
   else
   {
      Console::WriteLine( "Operations timed using the DateTime class." );
   }

   Int64 frequency = Stopwatch::Frequency;
   Console::WriteLine( "  Timer frequency in ticks per second = {0}", frequency );
   Int64 nanosecPerTick = (1000L * 1000L * 1000L) / frequency;
   Console::WriteLine( "  Timer is accurate within {0} nanoseconds", nanosecPerTick );
}

void TimeOperations()
{
   Int64 nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch::Frequency;
   const long numIterations = 10000;
   
   // Define the operation title names.
   array<String^>^operationNames = {"Operation: Int32.Parse(\"0\")","Operation: Int32.TryParse(\"0\")","Operation: Int32.Parse(\"a\")","Operation: Int32.TryParse(\"a\")"};
   
   // Time four different implementations for parsing 
   // an integer from a string. 
   for ( int operation = 0; operation <= 3; operation++ )
   {
      // Define variables for operation statistics.
      Int64 numTicks = 0;
      Int64 numRollovers = 0;
      Int64 maxTicks = 0;
      Int64 minTicks = Int64::MaxValue;
      int indexFastest = -1;
      int indexSlowest = -1;
      Int64 milliSec = 0;
      Stopwatch ^ time10kOperations = Stopwatch::StartNew();
      
      // Run the current operation 10001 times.
      // The first execution time will be tossed
      // out, since it can skew the average time.
      for ( int i = 0; i <= numIterations; i++ )
      {
         Int64 ticksThisTime = 0;
         int inputNum;
         Stopwatch ^ timePerParse;
         switch ( operation )
         {
            case 0:
               
               // Parse a valid integer using
               // a try-catch statement.
               // Start a new stopwatch timer.
               timePerParse = Stopwatch::StartNew();
               try
               {
                  inputNum = Int32::Parse( "0" );
               }
               catch ( FormatException^ ) 
               {
                  inputNum = 0;
               }

               // Stop the timer, and save the
               // elapsed ticks for the operation.
               timePerParse->Stop();
               ticksThisTime = timePerParse->ElapsedTicks;
               break;

            case 1:
               
               // Parse a valid integer using
               // the TryParse statement.
               // Start a new stopwatch timer.
               timePerParse = Stopwatch::StartNew();
               if (  !Int32::TryParse( "0", inputNum ) )
               {
                  inputNum = 0;
               }
               
               // Stop the timer, and save the
               // elapsed ticks for the operation.
               timePerParse->Stop();
               ticksThisTime = timePerParse->ElapsedTicks;
               break;

            case 2:
               
               // Parse an invalid value using
               // a try-catch statement.
               // Start a new stopwatch timer.
               timePerParse = Stopwatch::StartNew();
               try
               {
                  inputNum = Int32::Parse( "a" );
               }
               catch ( FormatException^ ) 
               {
                  inputNum = 0;
               }

               // Stop the timer, and save the
               // elapsed ticks for the operation.
               timePerParse->Stop();
               ticksThisTime = timePerParse->ElapsedTicks;
               break;

            case 3:
               
               // Parse an invalid value using
               // the TryParse statement.
               // Start a new stopwatch timer.
               timePerParse = Stopwatch::StartNew();
               if (  !Int32::TryParse( "a", inputNum ) )
               {
                  inputNum = 0;
               }
               
               // Stop the timer, and save the
               // elapsed ticks for the operation.
               timePerParse->Stop();
               ticksThisTime = timePerParse->ElapsedTicks;
               break;

            default:
               break;
         }

         // Skip over the time for the first operation,
         // just in case it caused a one-time
         // performance hit.
         if ( i == 0 )
         {
            time10kOperations->Reset();
            time10kOperations->Start();
         }
         else
         {
            // Update operation statistics
            // for iterations 1-10001.
            if ( maxTicks < ticksThisTime )
            {
               indexSlowest = i;
               maxTicks = ticksThisTime;
            }
            if ( minTicks > ticksThisTime )
            {
               indexFastest = i;
               minTicks = ticksThisTime;
            }
            numTicks += ticksThisTime;
            if ( numTicks < ticksThisTime )
            {
               // Keep track of rollovers.
               numRollovers++;
            }
         }
      }
      
      // Display the statistics for 10000 iterations.
      time10kOperations->Stop();
      milliSec = time10kOperations->ElapsedMilliseconds;
      Console::WriteLine();
      Console::WriteLine( "{0} Summary:", operationNames[ operation ] );
      Console::WriteLine( "  Slowest time:  #{0}/{1} = {2} ticks", indexSlowest, numIterations, maxTicks );
      Console::WriteLine( "  Fastest time:  #{0}/{1} = {2} ticks", indexFastest, numIterations, minTicks );
      Console::WriteLine( "  Average time:  {0} ticks = {1} nanoseconds", numTicks / numIterations, (numTicks * nanosecPerTick) / numIterations );
      Console::WriteLine( "  Total time looping through {0} operations: {1} milliseconds", numIterations, milliSec );

   }
}

int main()
{
   DisplayTimerProperties();
   Console::WriteLine();
   Console::WriteLine( "Press the Enter key to begin:" );
   Console::ReadLine();
   Console::WriteLine();
   TimeOperations();
}
using System;
using System.Diagnostics;

namespace StopWatchSample
{
    class OperationsTimer
    {
        public static void Main()
        {
            DisplayTimerProperties();

            Console.WriteLine();
            Console.WriteLine("Press the Enter key to begin:");
            Console.ReadLine();
            Console.WriteLine();

            TimeOperations();
        }

        public static void DisplayTimerProperties()
        {
            // Display the timer frequency and resolution.
            if (Stopwatch.IsHighResolution)
            {
                Console.WriteLine("Operations timed using the system's high-resolution performance counter.");
            }
            else 
            {
                Console.WriteLine("Operations timed using the DateTime class.");
            }

            long frequency = Stopwatch.Frequency;
            Console.WriteLine("  Timer frequency in ticks per second = {0}",
                frequency);
            long nanosecPerTick = (1000L*1000L*1000L) / frequency;
            Console.WriteLine("  Timer is accurate within {0} nanoseconds", 
                nanosecPerTick);
        }
        
        private static void TimeOperations()
        {
            long nanosecPerTick = (1000L*1000L*1000L) / Stopwatch.Frequency;
            const long numIterations = 10000;

            // Define the operation title names.
            String [] operationNames = {"Operation: Int32.Parse(\"0\")",
                                           "Operation: Int32.TryParse(\"0\")",
                                           "Operation: Int32.Parse(\"a\")",
                                           "Operation: Int32.TryParse(\"a\")"};
         

            // Time four different implementations for parsing 
            // an integer from a string. 

            for (int operation = 0; operation <= 3; operation++)
            {
                // Define variables for operation statistics.
                long numTicks = 0;
                long numRollovers = 0;
                long maxTicks = 0;
                long minTicks = Int64.MaxValue;
                int indexFastest = -1;
                int indexSlowest = -1;
                long milliSec = 0;

                Stopwatch time10kOperations = Stopwatch.StartNew();

                // Run the current operation 10001 times.
                // The first execution time will be tossed
                // out, since it can skew the average time.

                for (int i=0; i<=numIterations; i++) 
                {
                    long ticksThisTime = 0;
                    int inputNum;
                    Stopwatch timePerParse;

                    switch (operation)
                    {
                        case 0:
                            // Parse a valid integer using
                            // a try-catch statement.

                            // Start a new stopwatch timer.
                            timePerParse = Stopwatch.StartNew();

                            try 
                            {
                                inputNum = Int32.Parse("0");
                            }
                            catch (FormatException)
                            {
                                inputNum = 0;
                            }

                            // Stop the timer, and save the
                            // elapsed ticks for the operation.

                            timePerParse.Stop();
                            ticksThisTime = timePerParse.ElapsedTicks;
                            break;
                        case 1:
                            // Parse a valid integer using
                            // the TryParse statement.

                            // Start a new stopwatch timer.
                            timePerParse = Stopwatch.StartNew();

                            if (!Int32.TryParse("0", out inputNum))
                            { 
                                inputNum = 0;
                            }

                            // Stop the timer, and save the
                            // elapsed ticks for the operation.
                            timePerParse.Stop();
                            ticksThisTime = timePerParse.ElapsedTicks;
                            break;
                        case 2:
                            // Parse an invalid value using
                            // a try-catch statement.

                            // Start a new stopwatch timer.
                            timePerParse = Stopwatch.StartNew();

                            try 
                            {
                                inputNum = Int32.Parse("a");
                            }
                            catch (FormatException)
                            {
                                inputNum = 0;
                            }

                            // Stop the timer, and save the
                            // elapsed ticks for the operation.
                            timePerParse.Stop();
                            ticksThisTime = timePerParse.ElapsedTicks;
                            break;
                        case 3:
                            // Parse an invalid value using
                            // the TryParse statement.

                            // Start a new stopwatch timer.
                            timePerParse = Stopwatch.StartNew();

                            if (!Int32.TryParse("a", out inputNum))
                            { 
                                inputNum = 0;
                            }

                            // Stop the timer, and save the
                            // elapsed ticks for the operation.
                            timePerParse.Stop();
                            ticksThisTime = timePerParse.ElapsedTicks;
                            break;

                        default:
                            break;
                    }

                    // Skip over the time for the first operation,
                    // just in case it caused a one-time
                    // performance hit.
                    if (i == 0)
                    {
                        time10kOperations.Reset();
                        time10kOperations.Start();
                    }
                    else 
                    {

                        // Update operation statistics
                        // for iterations 1-10001.
                        if (maxTicks < ticksThisTime)
                        {
                            indexSlowest = i;
                            maxTicks = ticksThisTime;
                        }
                        if (minTicks > ticksThisTime)
                        {
                            indexFastest = i;
                            minTicks = ticksThisTime;
                        }
                        numTicks += ticksThisTime;
                        if (numTicks < ticksThisTime)
                        {
                            // Keep track of rollovers.
                            numRollovers ++;
                        }
                    }
                }  
                
                // Display the statistics for 10000 iterations.

                time10kOperations.Stop();
                milliSec = time10kOperations.ElapsedMilliseconds;

                Console.WriteLine();
                Console.WriteLine("{0} Summary:", operationNames[operation]);
                Console.WriteLine("  Slowest time:  #{0}/{1} = {2} ticks",
                    indexSlowest, numIterations, maxTicks);
                Console.WriteLine("  Fastest time:  #{0}/{1} = {2} ticks",
                    indexFastest, numIterations, minTicks);
                Console.WriteLine("  Average time:  {0} ticks = {1} nanoseconds", 
                    numTicks / numIterations, 
                    (numTicks * nanosecPerTick) / numIterations );
                Console.WriteLine("  Total time looping through {0} operations: {1} milliseconds", 
                    numIterations, milliSec);
            }
        }
     }
}
 
Imports System
Imports System.Diagnostics

Class OperationsTimer
   
   Public Shared Sub Main()
      DisplayTimerProperties()
      
      Console.WriteLine()
      Console.WriteLine("Press the Enter key to begin:")
      Console.ReadLine()
      Console.WriteLine()
      
      TimeOperations()
   End Sub
   
   
   Public Shared Sub DisplayTimerProperties()

      ' Display the timer frequency and resolution.
      If Stopwatch.IsHighResolution Then
         Console.WriteLine("Operations timed using the system's high-resolution performance counter.")
      Else
         Console.WriteLine("Operations timed using the DateTime class.")
      End If
      
      Dim frequency As Long = Stopwatch.Frequency
      Console.WriteLine("  Timer frequency in ticks per second = {0}", frequency)
      Dim nanosecPerTick As Long = 1000000000 / frequency
      Console.WriteLine("  Timer is accurate within {0} nanoseconds", nanosecPerTick)

   End Sub
   
   Private Shared Sub TimeOperations()

      Dim nanosecPerTick As Long = 1000000000 / Stopwatch.Frequency
      Const numIterations As Long = 10000
      
      ' Define the operation title names.
      Dim operationNames As String() =  _
        {"Operation: Int32.Parse(""0"")", _
         "Operation: Int32.TryParse(""0"")", _
         "Operation: Int32.Parse(""a"")", _
         "Operation: Int32.TryParse(""a"")"}
      
      ' Time four different implementations for parsing 
      ' an integer from a string. 

      Dim operation As Integer
      For operation = 0 To 3
         ' Define variables for operation statistics.
         Dim numTicks As Long = 0
         Dim numRollovers As Long = 0
         Dim maxTicks As Long = 0
         Dim minTicks As Long = Int64.MaxValue
         Dim indexFastest As Integer = - 1
         Dim indexSlowest As Integer = - 1
         Dim milliSec As Long = 0
         
         Dim time10kOperations As Stopwatch = Stopwatch.StartNew()
         
         ' Run the current operation 10001 times.
         ' The first execution time will be tossed
         ' out, since it can skew the average time.
         Dim i As Integer
         For i = 0 To numIterations
            Dim ticksThisTime As Long = 0
            Dim inputNum As Integer
            Dim timePerParse As Stopwatch
            
            Select Case operation
               Case 0
                  ' Parse a valid integer using
                  ' a try-catch statement.
                  ' Start a new stopwatch timer.
                  timePerParse = Stopwatch.StartNew()
                  
                  Try
                     inputNum = Int32.Parse("0")
                  Catch e As FormatException
                     inputNum = 0
                  End Try
                  
                  ' Stop the timer, and save the
                  ' elapsed ticks for the operation.
                  timePerParse.Stop()
                  ticksThisTime = timePerParse.ElapsedTicks
               Case 1
                  ' Parse a valid integer using
                  ' the TryParse statement.
                  ' Start a new stopwatch timer.
                  timePerParse = Stopwatch.StartNew()
                  
                  If Not Int32.TryParse("0", inputNum) Then
                     inputNum = 0
                  End If
                  
                  ' Stop the timer, and save the
                  ' elapsed ticks for the operation.
                  timePerParse.Stop()
                  ticksThisTime = timePerParse.ElapsedTicks
               Case 2
                  ' Parse an invalid value using
                  ' a try-catch statement.
                  ' Start a new stopwatch timer.
                  timePerParse = Stopwatch.StartNew()
                  
                  Try
                     inputNum = Int32.Parse("a")
                  Catch e As FormatException
                     inputNum = 0
                  End Try
                  
                  ' Stop the timer, and save the
                  ' elapsed ticks for the operation.
                  timePerParse.Stop()
                  ticksThisTime = timePerParse.ElapsedTicks
               Case 3
                  ' Parse an invalid value using
                  ' the TryParse statement.
                  ' Start a new stopwatch timer.
                  timePerParse = Stopwatch.StartNew()
                  
                  If Not Int32.TryParse("a", inputNum) Then
                     inputNum = 0
                  End If
                  
                  ' Stop the timer, and save the
                  ' elapsed ticks for the operation.
                  timePerParse.Stop()
                  ticksThisTime = timePerParse.ElapsedTicks
               
               Case Else
            End Select
            
            ' Skip over the time for the first operation,
            ' just in case it caused a one-time
            ' performance hit.
            If i = 0 Then
               time10kOperations.Reset()
               time10kOperations.Start()
            Else
               
               ' Update operation statistics
               ' for iterations 1-10001.
               If maxTicks < ticksThisTime Then
                  indexSlowest = i
                  maxTicks = ticksThisTime
               End If
               If minTicks > ticksThisTime Then
                  indexFastest = i
                  minTicks = ticksThisTime
               End If
               numTicks += ticksThisTime
               If numTicks < ticksThisTime Then
                  ' Keep track of rollovers.
                  numRollovers += 1
               End If
            End If
         Next i
         
         ' Display the statistics for 10000 iterations.
         time10kOperations.Stop()
         milliSec = time10kOperations.ElapsedMilliseconds
         
         Console.WriteLine()
         Console.WriteLine("{0} Summary:", operationNames(operation))
         Console.WriteLine("  Slowest time:  #{0}/{1} = {2} ticks", _
            indexSlowest, numIterations, maxTicks)
         Console.WriteLine("  Fastest time:  #{0}/{1} = {2} ticks", _
            indexFastest, numIterations, minTicks)
         Console.WriteLine("  Average time:  {0} ticks = {1} nanoseconds", _
            numTicks / numIterations, numTicks * nanosecPerTick / numIterations)
         Console.WriteLine("  Total time looping through {0} operations: {1} milliseconds", _
            numIterations, milliSec)
      Next operation

   End Sub
End Class

Açıklamalar

A Stopwatch örneği ölçmek geçen süre bir aralığı veya geçen süre toplam arasında birden çok aralık.A Stopwatch instance can measure elapsed time for one interval, or the total of elapsed time across multiple intervals. Tipik bir Stopwatch senaryosu, çağırmanızı Start yöntemi, sonunda çağrı Stop yöntemi ve daha sonra kontrol geçen süre kullanarak Elapsed özelliği.In a typical Stopwatch scenario, you call the Start method, then eventually call the Stop method, and then you check elapsed time using the Elapsed property.

A Stopwatch örneği çalışıyor veya durduruldu; kullanın IsRunning geçerli durumunu belirlemek için bir Stopwatch.A Stopwatch instance is either running or stopped; use IsRunning to determine the current state of a Stopwatch. Kullanma Start geçen süre; ölçmeye başlamak için kullanmak Stop geçen sürenin ölçülmesine durdurmak için.Use Start to begin measuring elapsed time; use Stop to stop measuring elapsed time. Geçen süre değeri özelliklerle sorgu Elapsed, ElapsedMilliseconds, veya ElapsedTicks.Query the elapsed time value through the properties Elapsed, ElapsedMilliseconds, or ElapsedTicks. Örneği çalışıyor veya durdurulmuş durumdayken geçen süre özelliklerini sorgulama yapabilirsiniz.You can query the elapsed time properties while the instance is running or stopped. Özellikleri kararlı bir şekilde artırın geçen süre while Stopwatch olan örneği durdurulduğunda çalıştırılan; bunlar sabit kalır.The elapsed time properties steadily increase while the Stopwatch is running; they remain constant when the instance is stopped.

Varsayılan olarak, geçen süre değerinin bir Stopwatch örneği tüm ölçülen zaman aralıkları toplam eşittir.By default, the elapsed time value of a Stopwatch instance equals the total of all measured time intervals. Her çağrı Start toplu geçen sırasında; sayım başladığı yapılan her çağrı Stop geçerli aralığı ölçüm sona erer ve toplam geçen süre değeri donuyor.Each call to Start begins counting at the cumulative elapsed time; each call to Stop ends the current interval measurement and freezes the cumulative elapsed time value. Kullanım Reset mevcut toplu geçen süresi yöntemi Stopwatch örneği.Use the Reset method to clear the cumulative elapsed time in an existing Stopwatch instance.

Stopwatch DPC temel Zamanlayıcı mekanizması içinde sayılarak geçen süreyi ölçer.The Stopwatch measures elapsed time by counting timer ticks in the underlying timer mechanism. Yüklü donanım ve işletim sistemi bir yüksek çözünürlüklü performans sayacı destekliyorsa sonra Stopwatch sınıfı geçen süreyi ölçmek için sayaç kullanır.If the installed hardware and operating system support a high-resolution performance counter, then the Stopwatch class uses that counter to measure elapsed time. Aksi takdirde Stopwatch sınıfı geçen süreyi ölçmek için sistem saati kullanır.Otherwise, the Stopwatch class uses the system timer to measure elapsed time. Kullanım Frequency ve IsHighResolution duyarlık ve çözümü belirlemek için alan Stopwatch zamanlama uygulaması.Use the Frequency and IsHighResolution fields to determine the precision and resolution of the Stopwatch timing implementation.

Stopwatch Sınıfı zamanlama ile ilgili performans sayaçları yönetilen kod içinde işlenmesini yardımcı olur.The Stopwatch class assists the manipulation of timing-related performance counters within managed code. Özellikle, Frequency alan ve GetTimestamp yöntemi yönetilmeyen Win32 API yerine kullanılabilir QueryPerformanceFrequency ve QueryPerformanceCounter.Specifically, the Frequency field and GetTimestamp method can be used in place of the unmanaged Win32 APIs QueryPerformanceFrequency and QueryPerformanceCounter.

Not

Çok işlemcili bir bilgisayarda hangi işlemci üzerinde çalıştığını iş parçacığı önemli değildir.On a multiprocessor computer, it does not matter which processor the thread runs on. Ancak, BIOS veya donanım özet düzeyi (HAL) hatalar nedeniyle farklı işlemciler üzerinde farklı zamanlama sonuçlar alabilirsiniz.However, because of bugs in the BIOS or the Hardware Abstraction Layer (HAL), you can get different timing results on different processors. Bir iş parçacığı için işlemci benzeşimi belirtmek için kullanın ProcessThread.ProcessorAffinity yöntemi.To specify processor affinity for a thread, use the ProcessThread.ProcessorAffinity method.

Oluşturucular

Stopwatch()

Yeni bir örneğini başlatır Stopwatch sınıfı. Initializes a new instance of the Stopwatch class.

Alanlar

Frequency

Zamanlayıcı sıklığını olarak saniyede tıklarının sayısını alır. Gets the frequency of the timer as the number of ticks per second. Bu alan salt okunurdur. This field is read-only.

IsHighResolution

Zamanlayıcı yüksek çözünürlüklü performans sayacına dayalı olup olmadığını gösterir. Indicates whether the timer is based on a high-resolution performance counter. Bu alan salt okunurdur. This field is read-only.

Özellikler

Elapsed

Geçerli örneği tarafından ölçülür. toplam geçen süre alır. Gets the total elapsed time measured by the current instance.

ElapsedMilliseconds

Toplam geçen süre, milisaniye cinsinden geçerli örneği tarafından ölçülmüştür alır. Gets the total elapsed time measured by the current instance, in milliseconds.

ElapsedTicks

Geçerli örnekte DPC ölçülen toplam geçen süre alır. Gets the total elapsed time measured by the current instance, in timer ticks.

IsRunning

Belirten bir değer alır olmadığını Stopwatch Zamanlayıcı çalışıyor. Gets a value indicating whether the Stopwatch timer is running.

Yöntemler

Equals(Object)

Belirtilen nesnenin geçerli nesneyle eşit olup olmadığını belirler. Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Varsayılan karma işlevi olarak görev yapar. Serves as the default hash function.

(Inherited from Object)
GetTimestamp()

Zamanlayıcı mekanizmasında geçerli tıklarının sayısını alır. Gets the current number of ticks in the timer mechanism.

GetType()

Alır Type geçerli örneği. Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Geçerli basit bir kopyasını oluşturur Object. Creates a shallow copy of the current Object.

(Inherited from Object)
Reset()

Zaman aralığı ölçümü durur ve geçen süreyi sıfırlar. Stops time interval measurement and resets the elapsed time to zero.

Restart()

Zaman aralığı ölçümü durdurur, geçen süreyi sıfırlar ve geçen süreyi ölçen başlatır. Stops time interval measurement, resets the elapsed time to zero, and starts measuring elapsed time.

Start()

Başlatır veya sürdürür, geçen süreyi ölçmek için bir aralık. Starts, or resumes, measuring elapsed time for an interval.

StartNew()

Yeni bir başlatır Stopwatch örneği, geçen süre özelliği sıfır olarak ayarlıyor ve geçen süreyi ölçen başlatır. Initializes a new Stopwatch instance, sets the elapsed time property to zero, and starts measuring elapsed time.

Stop()

Bir aralık için geçen süreyi ölçen durdurur. Stops measuring elapsed time for an interval.

ToString()

Geçerli nesneyi temsil eden bir dize döndürür. Returns a string that represents the current object.

(Inherited from Object)

Şunlara uygulanır

Ayrıca Bkz.