Learn R Programming

luajr (version 0.1.9)

lua_profile: Get profiling data

Description

After running Lua code with the profiler active (using lua_mode()), use this function to get the profiling data that has been collected.

Usage

lua_profile(flush = TRUE)

Value

An object of class "lua_profile".

Arguments

flush

If TRUE, clears the internal profile data buffer (default); if FALSE, doesn't. (Set to FALSE if you want to 'peek' at the profiling data collected so far, but you want to collect more data to add to this later.)

Details

This function is experimental. Its interface and behaviour may change in subsequent versions of luajr.

See Also

lua_mode() for generating the profiling data.

Examples

Run this code
if (FALSE) {
lua_mode(profile = TRUE)
pointless_computation = lua_func(
"function()
    local s = startval
    for i = 1,10^8 do
        s = math.sin(s)
        s = math.exp(s^2)
        s = s + 1
    end
    return s
end")
lua("startval = 100")
pointless_computation()
lua_mode(profile = FALSE)

prof = lua_profile()
}

Run the code above in your browser using DataLab