Skip to main content

Monitoring Routine Performance Using ^PROFILE

The ^PROFILE utility helps programmers analyze the performance of their application routines and classes. It accomplishes this task in two phases:

  1. It gathers data, sorted at the routine level, to help you identify which routines do the most “work.”

  2. It lets you select routines for which you want to gather and display data (subroutines, procedures, and individual lines) at line-level detail so that you can “drill down” into the individual routines that may be causing performance issues.

By default, ^PROFILE captures metrics for up to 5000 routines; if there is not enough shared memory available for the maximum number of routines, the utility displays a message about the number of pages of memory required to monitor this collection and the number of pages available. Then, the utility captures metrics for as many routines as possible.

Using ^PROFILE

Invoke the (^PROFILE) utility from the %SYS namespace:

%SYS>do ^PROFILE

When you are prompted to start the collection of data, press Enter.

Note:

When you are prompted for a response (other than Yes or No) you can enter ? to display online help.

By default, the profile displays a numbered list of routines with the following metrics; initially, the list is sorted by the RtnLine metrics:

Column Title (Metric) Description
RtnLine

Number of routine lines of code executed. By default, it lists the value as a percentage of all lines of code executed.

Time

Elapsed time used to execute the routine. By default, the time is listed as a percentage of the total time used by all routines.

CPU

CPU time used to execute the routine. By default, the entry is listed as a percentage of the total CPU time used by all routines.

RtnLoad

Number of times the routine is loaded. By default, the entry is listed as a percentage of all routine loads.

GloRef

Number of global references by the routine. By default, the entry is listed as a percentage of global references by all routines.

GloSet

Number of global sets by the routine. By default, the entry is listed as a percentage of global sets by all routines.

The name of the routine (INT or MVI file) and the namespace where it is executing is displayed on the second line of the entry.

Follow the instructions that are displayed in the Terminal:

  • When the list of routines is displayed at the profile level, you can specify any of the following:

    Option Description
    #

    Flag the specified line(s) for detailed profile-level data collection.

    Note:

    On each displayed page, you can enter single line numbers (#), a comma-separated list (#,#,#), a range (#-#), or a combination (#-#,#,#-#,#).

    After you select the routines on any page, you can move to the next or previous page to select other routines. After you select all the routines you want to analyze, enter Q to start the detail level profile collection.

    B

    Display the previous page of the list.

    E

    Export the displayed collection of metrics.

    N

    Display the next page of the list.

    O

    Re-sort the page based on different metrics (the selected metric is displayed in the first column).

    Q

    Exit from the ^PROFILE utility.

    Note:

    If you flagged routines that you want to analyze, this option lets you choose between collecting subroutine- and line-level metrics or exiting.

    R

    Refresh the list with the most recent metrics.

    X

    Clear all flags of selected routines (including those selected on other pages) and refresh the collection of metrics.

  • When the list of routines is displayed at the detailed profiling level, you can specify any of the following:

    Option Description
    #

    The line number of the routine you want to analyze in more detail. After you press Enter, the subroutine labels in the selected routine are displayed.

    B

    Display the previous page of the list.

    N

    Display the next page of the list.

    O

    Re-sort the page based on different metrics (the selected metric is displayed in the first column).

    Q

    Exit from the ^PROFILE utility.

    R

    Refresh the list with the most recent metrics.

  • When the list of subroutine labels (and metrics for each label) are displayed, you can specify any of the following:

    Option Description
    #

    The line number of the subroutine label (in the code) you want to analyze in more detail. After you press Enter, the code for the specified label is displayed.

    B

    Display the previous page of the list.

    L

    Switch to the line level display of the subroutine.

    N

    Display the next page of the list.

    Q

    Exit the list, return to the previous level.

    R

    Refresh the list with the most recent metrics.

    Note:

    If *Unknown* is displayed in the listing, enter R.

  • When lines of code are displayed, you are prompted to specify what you want to do next. Your options are:

    Option Description
    #

    The line number in the code you want to analyze in more detail. After you press Enter, the code for the specified label is displayed.

    B

    Display the previous page of the list.

    C

    Switch code display between source code and intermediate (INT/MVI) code.

    M

    Change the page margin and length.

    N

    Display the next page of the list.

    O

    Re-sort the page based on different metrics.

    Q

    Exit the list, returning to the previous level.

    R

    Refresh the list with the most recent metrics.

    S

    Switch to the subroutine level display of the routine.

^PROFILE Example

Following is an example of running the ^PROFILE utility interactively (from the %SYS namespace) in the Terminal:

  1. Enter the following command:

    do ^PROFILE
    
    
  2. The following message appears.

    WARNING: This routine will start a system-wide collection of
    data on routine activity and then display the results. There
    may be some overhead associated with the initial collection,
    and it could significantly affect a busy system.
     
    The second phase of collecting line level detail activity
    has high overhead and should ONLY BE RUN ON A TEST SYSTEM!
     
    Are you ready to start the collection?  Yes =>
    
  3. Press Enter to start collecting metrics. Metrics similar to the following are displayed:

     Waiting for initial data collection ...
     
          RtnLine     Time        CPU         RtnLoad     GloRef      GloSet
    1.    41.48%      12.19%      0.00%       28.97%      10.65%      0.00%
          %Library.ResultSet.1.INT (IRISLIB)
    2.    35.09%      56.16%      65.22%      9.35%       36.77%      42.55%
          SYS.Database.1.INT (IRISSYS)
    3.    10.75%      6.62%       0.00%       43.30%      22.68%      46.81%
          Config.Databases.1.INT (IRISSYS)
    4.    7.13%       3.22%       0.00%       6.23%       0.00%       0.00%
          %Library.Persistent.1.INT (IRISLIB)
    5.    1.26%       0.71%       0.00%       4.36%       4.12%       4.26%
          PROFILE.INT (IRISSYS)
    6.    1.20%       0.00%       0.00%       0.00%       5.15%       6.38%
          %SYS.WorkQueueMgr.INT (IRISSYS)
    7.    0.76%       15.08%      34.78%      0.00%       0.00%       0.00%
          %SYS.API.INT (IRISSYS)
    8.    0.64%       1.05%       0.00%       0.00%       17.18%      0.00%
          %Library.JournalState.1.INT (IRISLIB)
    9.    0.61%       0.31%       0.00%       3.74%       0.00%       0.00%
          %Library.IResultSet.1.INT (IRISLIB)
    10.   0.28%       0.93%       0.00%       0.00%       1.72%       0.00%
          %Library.Device.1.INT (IRISLIB)
    11.   0.24%       0.71%       0.00%       0.62%       0.00%       0.00%
          Config.CPF.1.INT (IRISSYS)
    Select routine(s) or '?' for more options  N =>
    
  4. Enter the number(s) associated with the routines you want to analyze in more detail. For example, enter 2–3,5,7,10, then enter N or B to display other pages so that you can select additional routines.

  5. After you select all the routines you want to analyze, enter Q to display a message similar to the following:

    There are 2 routines selected for detailed profiling. You may now
    end the routine level collection and start a detailed profiler collection.
     
    WARNING !!
     
    This will have each process on the system gather subroutine level and line
    level activity on these routines. Note that this part of the collection may
    have a significant effect on performance and should only be run in a test
    or development instance.
     
    Are you ready to start the detailed collection?  Yes =>
    
  6. After you press Enter, a page similar to the following is displayed:

    Stopping the routine level Profile collection ...
     
    Loading ^%Library.Persistent.1 in ^^c:\intersystems\iris\mgr\irislib\
     
    Detail level Profile collection started.
     
     
     
     
     
        RtnLine     Routine Name  (Database)
    1.  96.72%      %Library.Persistent.1.INT (IRISLIB)
    2.  3.28%       Config.CPF.1.INT (IRISSYS)
    Select routine to see details or '?' for more options  R =>
    
  7. After you select the routine whose code you want to analyze, the routine displays a page with information about the code.

FeedbackOpens in a new tab