PISystem.GetClientRpcMetrics Method
- Last UpdatedJan 12, 2026
- 3 minute read
- PI System
- AF SDK 3.2.0
- Developer
Get the remote procedure call metrics to the server for this PISystem.
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7
Syntax
public AFRpcMetric[] GetClientRpcMetrics()
Public Function GetClientRpcMetrics As AFRpcMetric() Dim instance As PISystem Dim returnValue As AFRpcMetric() returnValue = instance.GetClientRpcMetrics()
public: array<AFRpcMetric>^ GetClientRpcMetrics()
member GetClientRpcMetrics : unit -> AFRpcMetric[]
Return Value
Type: AFRpcMetricReturns an array of AFRpcMetric values that represent the remote procedure call metrics since the PISystem was instantiated.
Remarks
This will return the remote procedure call metrics for this PISystem in the client communicating with the server. The execution time reported in the metrics is the total execution time to make the call to the server including the time to communicate with the server.
You can use the SubtractList(IListAFRpcMetric, IListAFRpcMetric) method to return the difference between two arrays of AFRpcMetric values. This is useful to determine the metrics since the last call by subtracting the array returned by the previous call to this method from the current array of metrics.
| Since retries occur at the server and not the client level, client RPC metrics will have a RetryCount of zero. |
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); } }