AFStopwatch Class
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
A simpler and faster stop watch than System.Diagnostics.Stopwatch.
Inheritance Hierarchy
SystemObject
OSIsoft.AF.DiagnosticsAFStopwatch
OSIsoft.AF.DiagnosticsAFStopwatch
Namespace: OSIsoft.AF.Diagnostics
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public class AFStopwatch
Public Class AFStopwatch Dim instance As AFStopwatch
public ref class AFStopwatch
type AFStopwatch = class end
The AFStopwatch type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| AFStopwatch |
It initializes a new instance of the AFStopwatch class. It begins measuring elapsed time immediately.
|
Properties
| Name | Description | |
|---|---|---|
| ElapsedMilliseconds |
Return the elapsed time in milliseconds.
|
Methods
| Name | Description | |
|---|---|---|
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| Start |
Starts the stop watch (again if one is currently running).
| |
| ToString |
Returns a String that represents the current object.
(Overrides ObjectToString.) |
Remarks
The class uses Environment.TickCount. While it is several order of magnitude faster than StopWatch, it is
not as accurate and it restarts every 30 days (i.e., in very rare cases, it may return very large
negative values).