Helma Logo
main list history
previous version  overview  next version

Version 1 by hannes on 29. September 2009, 09:46

Helma 1.7 and Helma NG feature a profiler for measuring function runtime and invocation frequency. This page describes the Helma 1 profiler. For information on the NG profiler view the [dedicated page][Helma NG/Profiler].

To enable the profiler, add the following line to the [app.properties] or [server.properties] file:

    rhino.profile = true

Note that for the profiler to work, the application has to run in interpreted mode (rhino optimization level set to -1). If the `rhino.profile` property is set, this is taken care of automatically, but you have to start (or restart) the application with this setting - enabling the profiler at runtime will not work.

By default, the profiler will be used for all requests and internal invocations. The output is written to the application's event log and, if available, to the response's debug area. It looks like this:

    total  average  calls    path
    ==================================================================
    234 ms  234 ms      1    gobi-dev/code/Page/PageActions.js #220: create_action
    205 ms  205 ms      1    gobi-dev/code/HopObject/macros.js #8: skin_macro
    169 ms  169 ms      1    gobi-dev/code/Global/Global.js #495: include_macro
    166 ms  166 ms      1    gobi-dev/code/Page/PageMacros.js #8: body_macro
    166 ms  166 ms      1    gobi-dev/code/Global/WikiMarkup.js #29:
    166 ms  166 ms      1    gobi-dev/code/Page/PageMacros.js #330: list_macro
    165 ms  165 ms      1    gobi-dev/code/Global/PageList.js #76:
    98 ms    0 ms  1562    gobi-dev/code/Global/PageList.js #8:
    92 ms    0 ms    105    gobi-dev/code/Page/Permissions.js #152: checkAccess
    58 ms    0 ms    578    gobi-dev/code/Page/PageCore.js #343: getLink
    48 ms    0 ms    104    gobi-dev/code/Page/Permissions.js #173: getPermission
    46 ms    0 ms    103    gobi-dev/code/Page/Permissions.js #169: getPermissions
    45 ms    0 ms    103    gobi-dev/code/Global/Permissions.js #8:
    <truncated>

In order to only apply the profiler to requests for one particular user, set the `rhino.profile.session` property to the user's session id (the value of the user's HopSession cookie).

    rhino.profile = true
    rhino.profile.session = 127.0.0.1n5guagu2sdl2jslf

This allows you to use the debugger in production environments and only profile your own requests. Note that the application still needs to run in interpreted mode for everybody, though, but this usually won't have a huge impact on performance.

It's also possible to set the `rhino.profile.session` property so that it matches a substring of the session id. Since Helma session ids are prefixed with the user's IP address by default, this can be useful to only profile requests from a specific IP address or subnet. For example, the following setting will will cause only requests from the `192.168.0.0/255.255.255.0` subnet to be profiled.

    rhino.profile = true
    rhino.profile.session = 192.168.0

Be careful when running Helma in a local reverse proxy setup, though, as all sessions may be prefixed with 127.0.0.1 or an address from your LAN.

     removed
     added