We have noticed that the loadEventFrames method is not fully loading the full list of event frames every time we run it. Therefore, the loop on each object to get the referenced elements could be long. This is not constant and seems to be a problem of cache or from the loadeventframes!!!
We are doing the test with 20000 events. Here below is the code used to perform the test.
Dim AfEfListAll As IList(Of AFEventFrame)
Dim AfEfList As IList(Of AFEventFrame) = New List(Of AFEventFrame)
Dim _PiSyst As PISystem
Dim _PiSysts As New PISystems
Dim _afDb As AFDatabase
'Connection to PI/AF System.
_PiSyst = _PiSysts(txt_PISyst.Text)
'Connection to AF database.
_afDb = _PiSyst.Databases(txt_afdb.Text)
Dim afElmtCollection As AFNamedCollectionList(Of AFElement)
Dim afElmt As AFElement
'Get all AF Element matching the name of the AF element name.
afElmtCollection = AFElement.FindElements(_afDb, Nothing, txt_Elmt.Text, Nothing, Nothing, AFElementType.None, True, AFSortField.ID, AFSortOrder.Ascending, 1)
'AF Element has been found.
afElmt = afElmtCollection(0)
'Search Event Frames.
AfEfListAll = AFEventFrame.FindEventFrames(_afDb, _
Nothing, AFSearchMode.Overlapped, txt_ST.Text, txt_ET.Text, _
Nothing, txt_Elmt.Text, _
_afDb.ElementCategories(txt_EFCatg.Text), Nothing, Nothing, _
True, AFSortField.StartTime, AFSortOrder.Descending, 0, 300000)
If chxAFCacheClear.Checked = True Then
OSIsoft.AF.Diagnostics.AFCache.CacheTime = txtCachetime.Text
'Validation des event frame retrouvés
For Each afEventFrame As AFEventFrame In AfEfListAll
If afEventFrame.ReferencedElements.Contains(afElmt) Then
This code is used only for testing because it is part of a bigger application.
Thanks in advance for your inputs.
PS: I have also opened a call with the techsupport.