Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFRpcMetric Structure

  • Last UpdatedNov 18, 2025
  • 6 minute read
AFRpcMetric Structure
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

  NameDescription
Public property
Count
The total number of times this remote procedure call has been called.
Public property
Milliseconds
The total time spent executing this remote procedure call in milliseconds.
Public property
MillisecondsPerCall
The average time spent executing each call to this remote procedure call in milliseconds.
Public property
Name
The name of the remote procedure call method for the metric.
Public property
RetryCount
The total number of times this remote procedure call has been retried.

Methods

  NameDescription
Public method
Add
Adds the specified AFRpcMetric to this instance.
Public method
Equals(Object)
Determines whether the specified Object is equal to the current object.
(Overrides ValueTypeEquals(Object).)
Public method
Equals(AFRpcMetric)
Indicates whether the current object is equal to another object of the same type.
Public method
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.)
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
Subtract
Subtracts the specified AFRpcMetric from this instance.
Public methodStatic member
SubtractList
The subtraction method for a list of AFRpcMetric values returns the difference between the two lists of values.
Public methodStatic member
ToDictionary
Converts the AFRpcMetric list into a dictionary.
Public method
ToString
Returns the fully qualified type name of this instance.
(Inherited from ValueType.)

Operators

  NameDescription
Public operatorStatic member
Addition
The addition operator (-) returns the two values added together.
Public operatorStatic member
Equality
The equality operator (==) compares its operands to determine if they are equal.
Public operatorStatic member
Inequality
The inequality operator (!=) compares its operands to determine if they are not equal.
Public operatorStatic member
Subtraction
The subtraction operator (-) returns the difference between the two values.

Fields

  NameDescription
Public fieldStatic member
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.

Version Information

AFSDK


See Also

TitleResults for “How to create a CRG?”Also Available in