AFRpcMetric Structure
- Last UpdatedNov 18, 2025
- 6 minute read
- PI System
- AF SDK 2024 R2
- Developer
This structure is used to represent the remote procedure call metrics of the server.
Namespace: OSIsoft.AF.Diagnostics
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public struct AFRpcMetric : IEquatable<AFRpcMetric>
Public Structure AFRpcMetric Implements IEquatable(Of AFRpcMetric) Dim instance As AFRpcMetric
public value class AFRpcMetric : IEquatable<AFRpcMetric>
[<SealedAttribute>] type AFRpcMetric = struct interface IEquatable<AFRpcMetric> end
The AFRpcMetric type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
| Count |
The total number of times this remote procedure call has been called.
| |
| Milliseconds |
The total time spent executing this remote procedure call in milliseconds.
| |
| MillisecondsPerCall |
The average time spent executing each call to this remote procedure call in milliseconds.
| |
| Name |
The name of the remote procedure call method for the metric.
| |
| RetryCount |
The total number of times this remote procedure call has been retried.
|
Methods
| Name | Description | |
|---|---|---|
| Add |
Adds the specified AFRpcMetric to this instance.
| |
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Overrides ValueTypeEquals(Object).) | |
| Equals(AFRpcMetric) |
Indicates whether the current object is equal to another object of the same type.
| |
| GetHashCode |
Gets the hash code for this instance of the object which is suitable for use in hashing
algorithms and data structures like a hash table.
(Overrides ValueTypeGetHashCode.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| Subtract |
Subtracts the specified AFRpcMetric from this instance.
| |
| SubtractList |
The subtraction method for a list of AFRpcMetric values returns the
difference between the two lists of values.
| |
| ToDictionary |
Converts the AFRpcMetric list into a dictionary.
| |
| ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType.) |
Operators
| Name | Description | |
|---|---|---|
| Addition |
The addition operator (-) returns the two values added together.
| |
| Equality |
The equality operator (==) compares its operands to determine if they are equal.
| |
| Inequality |
The inequality operator (!=) compares its operands to determine if they are not equal.
| |
| Subtraction |
The subtraction operator (-) returns the difference between the two values.
|
Fields
| Name | Description | |
|---|---|---|
| Empty |
Represents the empty AFRpcMetric.
|
Remarks
Examples
// This example demonstrates how to get and display RpcMetrics // Get the Database PISystems myPISystems = new PISystems(); PISystem myPISystem = myPISystems.DefaultPISystem; AFDatabase myDB = myPISystem.Databases.DefaultDatabase; // Get current metrics AFRpcMetric[] lastClientMetrics = myPISystem.GetClientRpcMetrics(); AFRpcMetric[] lastServerMetrics = myPISystem.GetRpcMetrics(); // Do some operations which load objects from the server AFNamedCollectionList<AFElement> allElements = AFElement.LoadElementsToDepth(myDB.Elements, true, 4, 2000); // Get new client metrics and display results AFRpcMetric[] newClientMetrics = myPISystem.GetClientRpcMetrics(); IList<AFRpcMetric> diffClientMetrics = AFRpcMetric.SubtractList(newClientMetrics, lastClientMetrics); Console.WriteLine("Client RPC, Count, RetryCount, Duration(ms), PerCall(ms)"); if (null != diffClientMetrics) { foreach (AFRpcMetric item in diffClientMetrics) { Console.WriteLine("{0}, {1}, {2}, {3:F1}, {4:F3}", item.Name, item.Count, item.RetryCount, item.Milliseconds, item.MillisecondsPerCall); } } // Get new server metrics and display results Console.WriteLine(); AFRpcMetric[] newServerMetrics = myPISystem.GetRpcMetrics(); IList<AFRpcMetric> diffServerMetrics = AFRpcMetric.SubtractList(newServerMetrics, lastServerMetrics); Console.WriteLine("Server RPC, Count, RetryCount, Duration(ms), PerCall(ms)"); if (null != diffServerMetrics) { foreach (AFRpcMetric item in diffServerMetrics) { Console.WriteLine("{0}, {1}, {2}, {3:F1}, {4:F3}", item.Name, item.Count, item.RetryCount, item.Milliseconds, item.MillisecondsPerCall); } }
' This example demonstrates how to get and display RpcMetrics ' Get the Database Dim myPISystems As New PISystems Dim myPISystem As PISystem = myPISystems.DefaultPISystem Dim myDB As AFDatabase = myPISystem.Databases.DefaultDatabase ' Get current metrics Dim lastClientMetrics() As AFRpcMetric = myPISystem.GetClientRpcMetrics Dim lastServerMetrics() As AFRpcMetric = myPISystem.GetRpcMetrics ' Do some operations which load objects from the server Dim allElements As AFNamedCollectionList(Of AFElement) = AFElement.LoadElementsToDepth(myDB.Elements, True, 4, 2000) ' Get new client metrics and display results Dim newClientMetrics() As AFRpcMetric = myPISystem.GetClientRpcMetrics Dim diffClientMetrics As IList(Of AFRpcMetric) = AFRpcMetric.SubtractList(newClientMetrics, lastClientMetrics) Console.WriteLine("Client RPC, Count, RetryCount, Duration(ms), PerCall(ms)") If (Not (diffClientMetrics) Is Nothing) Then For Each item As AFRpcMetric In diffClientMetrics Console.WriteLine("{0}, {1}, {2}, {3:F1}, {4:F3}", item.Name, item.Count, item.RetryCount, item.Milliseconds, item.MillisecondsPerCall) Next End If ' Get new server metrics and display results Console.WriteLine() Dim newServerMetrics() As AFRpcMetric = myPISystem.GetRpcMetrics Dim diffServerMetrics As IList(Of AFRpcMetric) = AFRpcMetric.SubtractList(newServerMetrics, lastServerMetrics) Console.WriteLine("Server RPC, Count, RetryCount, Duration(ms), PerCall(ms)") If (Not (diffServerMetrics) Is Nothing) Then For Each item As AFRpcMetric In diffServerMetrics Console.WriteLine("{0}, {1}, {2}, {3:F1}, {4:F3}", item.Name, item.Count, item.RetryCount, item.Milliseconds, item.MillisecondsPerCall) Next End If
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.