How to activate --profile.api when using ScriptingContainer?

Hi all!

How can I set profiling mode to API when using ScriptingContainer?

–
Uwe K.
Systems Developer
Datek Wireless AS
[email protected]

On 2011-11-17, at 15:14, Uwe K. wrote:

How can I set profiling mode to API when using ScriptingContainer?

No takers on this? Is there no way to profile Ruby code when using the
ScriptingContainer?

–
Uwe K.
Systems Developer
Datek Wireless AS
[email protected]

On Sun, Nov 20, 2011 at 8:31 AM, Uwe K. [email protected] wrote:

On 2011-11-17, at 15:14, Uwe K. wrote:

How can I set profiling mode to API when using ScriptingContainer?

ScriptingContainer had getProfilingMode and setProfilingMode methods.
ScriptingContainer users can set the mode programmatically.

Example:

import org.jruby.RubyInstanceConfig.ProfilingMode;
import org.jruby.embed.ScriptingContainer;
...
ScriptingContainer container = new ScriptingContainer()
container.setProfile(ProfilingMode.GRAPH);

You can set parameters below:

ProfilingMode.OFF default
ProfilingMode.API same as --profile.api command line option
ProfilingMode.FLAT same as --profile.flat command line option
ProfilingMode.GRAPH same as --profile.graph command line option

Just in case, you want to set profiling mode on 1.6.5, you can set that
by:

container.getProvider().getRubyInstanceConfig().setProfilingMode(mode);

The methods will be available from 1.6.6 (if this version is released)
and 1.7 .

-Yoko