Understanding properties and counters on a frame

Guidewire profiler frames can hold custom properties and counters that provide more information about system events. Consider the following example:

uses gw.api.profiler.Profiler
uses gw.api.profiler.ProfilerTag

public class MyProfilerTags {
  
  public static var paramValue : String
  public static var ctrValue : Integer

  var frame = Profiler.push(MyProfilerTags.myProfilerTag)
  
  public function profileCode() {

     public static var myProfilerTag: ProfilerTag = new ProfilerTag("MY_TAG")
  
    try {
      
      //Some paramter value, set by method code...
      var param = "some parameter value"
      
      //Some counter value, set by method code
      var ctr = 5
      
      frame.setPropertyValue("PARAMETER", param)
      frame.setCounterValue("COUNTER", ctr)
      
      } finally {
      
      Profiler.pop(frame)
        
    }
  
  }

}

After the sample code pops a profiler frame off the stack, the frame contains information about the calculated values of PARAMETER and COUNTER. The Server Tools Profiler Analysis screen then shows these values as well.

Notice also that the frame PUSH operation is outside the try block. The POP operation occurs in the try finally code. If you include the PUSH and POP operations inside code that iterates (a for loop, for example), each iteration of the code creates a new frame.

See also