AnsweredAssumed Answered

Need to Improve performance on finding & retrieving eventframes

Question asked by Soundararajan on Jun 20, 2017
Latest reply on Nov 16, 2017 by Rick Davin

We need to find Eventframes generated for last 21 days and retrieve the attributes (nearly 10) for those. For that we are using FindEventFrames PI-SDK method with the startTime parameter as "t-21d" and getting around 40K event frames in the elapsed time of 9min. This is currently taking a lot of time and we need to improve performance a lot. Please suggest us improving performance, by which methods we need to choose for that.

Code used for finding and retrieving eventframes.

 

var eventFrames = AFEventFrame.FindEventFrames(
                      database: afDatabase,
                      searchRoot: null,
                      startTime: "t-21d",
                      startIndex: 0,
                      maxCount: int.MaxValue,
                      searchMode: AFEventFrameSearchMode.ForwardFromStartTime,
                      nameFilter: "",
                      referencedElementNameFilter: "",
                      elemCategory: null,
                      elemTemplate: efTemplate,
                      searchFullHierarchy: true);

 

          foreach (AFEventFrame ef in eventFrames)
                {
                    var val1 = ef.Attributes["AssetGlobalUniqueId"].GetValue();
                    var val2 = ef.Attributes["EventDefinitionId"].GetValue();
                    var val3 = ef.Attributes["DetectorId"].GetValue();

                }

Outcomes