How to Make a Profile using the Stand-alone Profiler from Within Another Application

Previous Next

See Also

The USoft BenchMark Profiler can be started from within any USoft application in order to profile a certain transaction. Such a profile can be used to investigate the transaction and locate bugs and performance bottlenecks. Three Rules Engine methods can be used to register profiler information in the USoft BenchMark tables without using the BenchMark GUI interface:

· RuleProfilerStart


· RuleProfilerStop


· RuleProfilerDescription<description>

For example:

   INVOKE RulesEngine.RuleProfilerStart;

   INVOKE RulesEngine.RuleProfilerDescription


   SELECT 'Performance test';

   INVOKE RulesEngine.RuleProfilerStop;

These methods have been specifically developed so that the BenchMark Profiler can be started when SQL is the only interface. RuleProfilerStart and RuleProfilerStop require no parameters. RuleProfilerDescription() has one mandatory parameter: description, which is a description of the currently active profiler session.

Since this is a generic extension of the USoft SQL, the syntax can be used everywhere an INVOKE statement is allowed. It will therefore also be possible to start/stop the profiler from within a constraint. This is also convenient for situation in which there is no SQL Command-like interface available, for example in the Remote Rules Service. When using the ODBC interface, the methods are activated by issuing a call to the ODBC SQLFetch function for the statement

The profiling session that is started using the 'RuleProfilerStart' method, is related to the Rules Engine through which the INVOKE statement was issued. If the Rules Engine is pooled, the profiling session will stay alive until a 'RuleProfilerStop' is issued

Reading and interpreting the results stored by the stand-alone profiler should still be performed using the USoft BenchMark GUI interface.


It is possible to use a different database account for the profiler (BenchMark) tables, as it is already possible with USoft BenchMark. You can do this using the three optional parameters that are available for RuleProfilerStart method:

   INVOKE RulesEngine.RuleProfilerStart


   SELECT <username>, <password>, <database>;

For example

   INVOKE RulesEngine.RuleProfilerStart




You can also start the BenchMark Profiler by accessing the Rules Service via the HTTP protocol, using an HTTP command with the following syntax:



· <host> is the name of the server where the Rules Service is running.


· <port> is the port number that the Rules Service uses to communicate with client applications.


· <application> is the name of the USoft application.


· <user> is the name of the USoft application user.

For example:


The resulting text is: "Profiler activated". Only the Rules Engine through which the RuleProfilerStart command was issued will be profiled. You should ensure that this is the only Rules Engine that is running for the application that you wish to profile. You can do this in the Rules Service configuration pages, which are accessed from the Rules Service item property sheets in the Binder. Set the value for both Minimum and Maximum number of Rules Engines to 1.

You can stop the Profiler with the following HTTP call:


with resulting text: "Rule profiler stopped successfully".


If you are profiling statements sent to the Rules Service via the Remote Rules Service API, you must ensure that the application that is sending the statements to the Remote Rules Service API has stopped and has disconnected from the Remote Rules Service before you stop the Profiler. If this is not done before the RuleProfilerStop command is issued, the following error message may be displayed:

"Done AttachToEngine: NO_RULES_ENGINE_FOUND".

This error message indicates that the (single) engine is still in use, and it is not possible to send the 'RuleProfilerStop' command to the engine.

Also note that when using an ODBC connection, the connection might continue to be active if connection pooling is switched on. Make sure that connection pooling is not switched on when you are profiling.

For more information, refer to the Definer help topic: "Connecting to the Rules Service via HTTP".