Using Functions

This section assumes you understand how to use TIBCO BusinessEvents functions. It tells you which functions to use and the effect of each function.

Tip: You can turn the Profiler on using the engine properties, and turn it off using a function or Hawk method, as desired. See notes for be.engine.Agent_Class_Name.profile.duration and be.engine.*.profile.duration in Using PropertiesSet the following properties in the Cluster Deployment Descriptor (CDD) Processing Unit tab, for all processing units (engines) whose RTC performance you want to profile.Profiler Configuration Properties (Sheet of )PropertyNotesbe.engine.profile.Agent_Class_Name.enable If set to true, enables Profiler for the specified agent class (Agent_Class_Name) when the agent initializes.Default is false.be.engine.profile.*.enable If set to true, enables the Profiler for all agents when each agent initializes, even when a specified agent class Profiler is disabled.Default is false.be.engine.profile.Agent_Class_Name.file The name of output file that the Profiler writes to, for the specified agent (Agent_Class_Name).Default behavior is as follows:If be.engine.profile.*.file is specified and be.engine.profile.Agent_Class_Name.file is not specified, then the file name is the value of be.engine.profile.*.file, with the Agent_Class_Name appended.If the properties be.engine.profile.*.file and be.engine.profile.Agent_Class_Name.files are not specified the name is created as follows: be-profile_Agent_Class_Name.csvbe.engine.profile.*.file The default (prefix for the) name of the output file that the Profiler writes to. In all cases, the appropriate Agent_Class_Name is appended.Default name is be-profile.csv and it is located under the current working directory, if file name is not specified.be.engine.profile.Agent_Class_Name.duration  Specifies the duration of profile data collection in seconds, for the specified Agent_Class_Name).When the duration period ends, the Profiler continues to collect statistics for the current RTC until the RTC is completed, then outputs data and stops. So the RTC in progress is always completed, even if the Profiler is directed to stop during an RTC.If you set duration to a value of zero or less (<= 0), then profiling continues until agent stops or Profiler is explicitly turned of using a function or Hawk method.Default is -1.be.engine.profile.*.duration Specifies the duration of profile data collection in seconds, for all agents.When the duration period ends, the Profiler continues to collect statistics for the current RTC until the RTC is completed, then outputs data and stops. So the RTC in progress is always completed, even if the Profiler is directed to stop during an RTC.If you set duration to a value of zero or less (<= 0), then profiling continues until the agents stop or Profiler is explicitly turned of using a function or Hawk method.When be.engine.profile.Agent_Class_Name.duration and be.engine.profile.*.duration are both present, the duration specified in be.engine.profile.Agent_Class_Name.duration takes precedence.Default is -1.be.engine.profile.Agent_Class_Name.level Level of depth that profile data will be collected for the specified agent (Agent_Class_Name):-1: all levels of profile data are collected, including RTC level and conditions and actions within the RTC.1: Only RTC level of profile data will be collected (and no condition and action data).Default is -1.be.engine.profile.*.level Level of depth that profile data will be collected for all agents:-1: all levels of profile data are collected, including RTC level and conditions and actions within the RTC.1: Only RTC level of profile data will be collected (and no condition and action data).When be.engine.profile.Agent_Class_Name.level and be.engine.profile.*.level are both present, the level specified in be.engine.profile.Agent_Class_Name.level takes precedence.Default is -1. .
To turn the Profiler on
 In your rule or rule function, use the following function to turn on the Profiler:
Engine.Profiler.startCollectingToFile(String fileName, int level, long duration)

The above function turns on the TIBCO BusinessEvents Profiler and starts collecting data for the specified duration for the agent in which the rule or rule function that calls this function is executed. The Profiler starts collecting data at the beginning of next RTC.

Profile data is output to the specified file in comma-separated value format at the end of the duration period, unless the Profiler is turned off before the end of the duration, in which case it is output at the end of the RTC that completes after the Profiler is turned off.

Input arguments are the same as the engine properties show in Using PropertiesSet the following properties in the Cluster Deployment Descriptor (CDD) Processing Unit tab, for all processing units (engines) whose RTC performance you want to profile.Profiler Configuration Properties (Sheet of )PropertyNotesbe.engine.profile.Agent_Class_Name.enable If set to true, enables Profiler for the specified agent class (Agent_Class_Name) when the agent initializes.Default is false.be.engine.profile.*.enable If set to true, enables the Profiler for all agents when each agent initializes, even when a specified agent class Profiler is disabled.Default is false.be.engine.profile.Agent_Class_Name.file The name of output file that the Profiler writes to, for the specified agent (Agent_Class_Name).Default behavior is as follows:If be.engine.profile.*.file is specified and be.engine.profile.Agent_Class_Name.file is not specified, then the file name is the value of be.engine.profile.*.file, with the Agent_Class_Name appended.If the properties be.engine.profile.*.file and be.engine.profile.Agent_Class_Name.files are not specified the name is created as follows: be-profile_Agent_Class_Name.csvbe.engine.profile.*.file The default (prefix for the) name of the output file that the Profiler writes to. In all cases, the appropriate Agent_Class_Name is appended.Default name is be-profile.csv and it is located under the current working directory, if file name is not specified.be.engine.profile.Agent_Class_Name.duration  Specifies the duration of profile data collection in seconds, for the specified Agent_Class_Name).When the duration period ends, the Profiler continues to collect statistics for the current RTC until the RTC is completed, then outputs data and stops. So the RTC in progress is always completed, even if the Profiler is directed to stop during an RTC.If you set duration to a value of zero or less (<= 0), then profiling continues until agent stops or Profiler is explicitly turned of using a function or Hawk method.Default is -1.be.engine.profile.*.duration Specifies the duration of profile data collection in seconds, for all agents.When the duration period ends, the Profiler continues to collect statistics for the current RTC until the RTC is completed, then outputs data and stops. So the RTC in progress is always completed, even if the Profiler is directed to stop during an RTC.If you set duration to a value of zero or less (<= 0), then profiling continues until the agents stop or Profiler is explicitly turned of using a function or Hawk method.When be.engine.profile.Agent_Class_Name.duration and be.engine.profile.*.duration are both present, the duration specified in be.engine.profile.Agent_Class_Name.duration takes precedence.Default is -1.be.engine.profile.Agent_Class_Name.level Level of depth that profile data will be collected for the specified agent (Agent_Class_Name):-1: all levels of profile data are collected, including RTC level and conditions and actions within the RTC.1: Only RTC level of profile data will be collected (and no condition and action data).Default is -1.be.engine.profile.*.level Level of depth that profile data will be collected for all agents:-1: all levels of profile data are collected, including RTC level and conditions and actions within the RTC.1: Only RTC level of profile data will be collected (and no condition and action data).When be.engine.profile.Agent_Class_Name.level and be.engine.profile.*.level are both present, the level specified in be.engine.profile.Agent_Class_Name.level takes precedence.Default is -1.:

String fileName: See be.engine.profile.Agent_Class_Name.file

int level: See be.engine.profile.Agent_Class_Name.level

long duration: See be.engine.profile.Agent_Class_Name.duration (Here Agent_Class_Name is the current agent in which the rule or rule function that calls this function is executed.)

To turn the Profiler off
 In your rule or rule function, use the following function to turn off the Profiler:
Engine.Profiler.stopCollecting()

The above function turns off the TIBCO BusinessEvents Profiler and writes the profile data to a file for the agent in which the rule or rule function that calls this function is included (the file is output at the end of the RTC that completes after the Profiler is turned off). There is no effect if the Profiler is not on.