Agent Profiling Click here to see all the Developer/Admin Tips

Date tip published:10/04/2005
Description:Domino 7 has a new feature that developers can use to fine tune agents and web services, Agent Profiling. This measures the time it takes to perform each back end Domino method that is in the agent. This data can then be used to fine tune the agent. Profiling can be used for both LotusScript and Java agents and web services.


To learn more about the new features in Notes Domino 7 use the following links:

Notes Domino 7 Application Development Update
DB2 for Domino 7 Administrators and Developers



Agent Profiling

Domino 7 has a new feature that developers can use to fine tune agents and web services, Agent Profiling. This measures the time it takes to perform each back end Domino method that is in the agent. This data can then be used to fine tune the agent. Profiling can be used for both LotusScript and Java agents and web services.

Below is an image showing the results from an agent profile.





The name of the agent is shown at the top along with the date and time when the agent was run. The table has columns for:
    • Class - the Domino back end class
    • Method - the method being called
    • Operation - shows what operation was used for properties (Get or Set)
    • Calls - the number of calls to that method
    • Time - the total time in milliseconds to run all calls to this method
The code for the above profiled agent is shown below. It ran on 69 documents in the Parts database. This agent loops through the PartsView view and gets a field from a Domino document which is stored in an array. The GetNextDocument method is used to loop through the view. In the profile above, the GetNextDocument was called 69 times. The field was referenced by using the dot notation (doc.partname(0)) which is the first line in the table above. The other three calls (GetView, CurrentDatabase, and GetFirstDocument) were called only once and took a minimal amount of time.

Sub Initialize
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim session As New NotesSession
Set db = session.CurrentDatabase
Dim view As NotesView
Set view = db.GetView("PartsView")
Set doc = view.GetFirstDocument
Dim results() As String
Dim i As Integer
i=0
Do Until doc Is Nothing
Redim Preserve results(0 To i)
results(i) = doc.partname(0)
i = i+1
Set doc =view.GetNextDocument(doc)
Loop
End Sub




Procedure: Enabling Agent Profiling

Agent Profiling is enabled on an agent-by-agent basis in the agent's security properties as shown in the following image. Once enabled, profiling occurs on every agent run regardless of the agent type or if it runs on a Notes client or a Domino server.







Procedure: Viewing the Profile Results


Follow these steps to view the Agent Profiling results:

  1. Open the Agent List in Domino Designer.
  2. Select the agent to view its profile results.
  3. Choose Agent | View Profile Results from the menu.
  4. The profile results will open in a window tab in the Notes client.





Tip

Only Domino Back-End Objects are Profiled


Only back-end classes in the Domino Object Model are profiled. Any other class (such as user defined classes or Notes front-end classes) are not profiled. The core LotusScript functions are not profiled.



Note

Use Agent Profiling for Java Agents and Web Services


You can also profile Java agents. The following image shows the profiling results when a similar Java agent is run.




To profile a Web Service, set the "Profile this web service" option in the Web Service's secutity properties.