profile

Synopsis

@ profile()

Returns the profiler statistics for the current script environment. Profiler statistics will only be collected if DEBUG_TRACE_CALLS (8) or DEBUG_TRACE_PROFILE_ONLY (24) are enabled.

Returns

An array of sleep.runtime.ScriptInstance$ProfilerStatistic objects. They have a decent String representation if you choose to utilize that.

Side Effects / Notes

Examples

# enable collection of profiler statistics debug(debug() | 24); # some activity to give us something to profile... sub fact { return iff($1 == 0, 1, $1 * [$this : $1 - 1]); } $x = ["test" length]; [{ return "this is a closure call!: " . fact(10.0); }]; # print out the profile of this code... @stats = profile(); foreach $var (@stats) { println($var); }

0.0010s 10 &closure[profile.sl:6] 0.0s 1 &fact 0.0s 1 public int java.lang.String.length() 0.0s 1 &closure[profile.sl:10]

See Also