API Reference
Item | Summary |
---|---|
lfsampler | |
lfsampler.anyAvailable | Checks whether an profiler is available |
lfsampler.currentProfiler | Retrieves current selected profiler |
lfsampler.discard | Discards current results. If they are not discarded, any subsequent sessions, will accumulate |
lfsampler.getResults | Returns current results (copy) |
lfsampler.isAvailable | Returns whether or not specified profiler is available |
lfsampler.isRunning | Return whether or not the profiler is running |
lfsampler.popResults | Returns results and then discards them. Use this if you want to have seperate session results. |
lfsampler.setProfiler | Sets profiler to use |
lfsampler.start | Starts the session |
lfsampler.stop | Stops the session |
lfsampler.AccumulatedProbe | |
lfsampler.AccumulatedProbe.callCount | |
lfsampler.AccumulatedProbe.sampleCount | |
lfsampler.AccumulatedProbe.stacktrace | A stacktrace is just a list of locations |
lfsampler.AccumulatedResults | Containing unique stacktraces, accumulated over all samples |
lfsampler.Location | Represents a stackframe location |
lfsampler.Location.file | |
lfsampler.Location.func | |
lfsampler.Location.line | |
lfsampler.Probe | A probe, containing info about samples inside a specific stacktrace |
lfsampler.Probe.sampleCount | |
lfsampler.Probe.stacktrace | A stacktrace is just a list of locations |
lfsampler.ProfilerResults | |
lfsampler.ProfilerResults:accumulate | Accumulates all stacktraces collapsed by given hash function |
lfsampler.ProfilerResults.actualRate | Rate in millisecond per sample |
lfsampler.ProfilerResults.duration | Accumulated duration |
lfsampler.ProfilerResults:new | |
lfsampler.ProfilerResults.probes | |
lfsampler.ProfilerResults:squash | Same as accumulate, but keeps order. |
lfsampler.ProfilerResults.totalSamples | Total sample count |
lfsampler.ProfilerType | ```lua |
lfsampler.SquashedOrderedResults | Same as lfsampler.AccumulatedResults, but keeps the order, so the stacktraces may not be unique |
lfsampler.Stacktrace | A stacktrace is just a list of locations |
lfsampler.formatters | A collection of functions to interpret lfsampler.ProfilerResults |
lfsampler.formatters.annotateSource | Returns completly annotated source code foreach module |
lfsampler.formatters.flamegraph | Formats results according to FlameGraph |
lfsampler.formatters.formatReport | Formats given results into an easly printable report. |
lfsampler.formatters.granularityFunc | Hash function for stacktrace by function name |
lfsampler.formatters.granularityLine | Hash function for stacktrace by file and function name and line |
lfsampler.formatters.sortBySampleCount | Comparates two { sampleCount: integer } by > |
Checks whether an profiler is available
boolean
Retrieves current selected profiler
"debug"|"dummy"|"jit"
Discards current results. If they are not discarded, any subsequent sessions, will accumulate
Returns current results (copy)
Returns whether or not specified profiler is available
-
profiler_type
-any
boolean
Return whether or not the profiler is running
boolean
Returns results and then discards them. Use this if you want to have seperate session results.
Sets profiler to use
-
profiler_type
-"debug"|"dummy"|"jit"
- jit uses jit.profile, debug uses the debug api, and dummy does absolutly nothing
-
n
-integer
- debug: The instruction rate at which samples are collected, jit: Sample rate in milliseconds. Is OS-Dependant
Starts the session
Stops the session
- type:
integer
- type:
integer
A stacktrace is just a list of locations
- type: lfsampler.Location
[]
- type:
string
- type:
string
- type:
number
- type:
integer
A stacktrace is just a list of locations
- type: lfsampler.Location
[]
Accumulates all stacktraces collapsed by given hash function
-
hash
-fun(stacktrace:
lfsampler.Location[]):any
Rate in millisecond per sample
- type:
number
Accumulated duration
- type:
integer
- type: lfsampler.Probe
[]
Same as accumulate, but keeps order.
-
hash
-fun(stacktrace:
lfsampler.Location[])
Total sample count
- type:
integer
- Alias:
"debug"|"dummy"|"jit"
- Alias: lfsampler.Location
[]
Returns completly annotated source code foreach module
-
results
- lfsampler.ProfilerResults -
searchDirs
-string?
- Semicolon seperated list of extra search paths (beside package.path)
-
table<string, string>
- { [path]: annotations }
Formats results according to FlameGraph
Format: <file>(:<line>)?-<func>;... <samples>\n...
-
results
- lfsampler.ProfilerResults -
type
-"chart"|"graph"
-
granularityFormatter
-fun(stacktrace:
lfsampler.Location[])
- e.g. formatters.granularityLine
string
Formats given results into an easly printable report.
-
results
- lfsampler.ProfilerResults
string
Hash function for stacktrace by function name
-
stacktrace
- lfsampler.Location[]
- A stacktrace is just a list of locations
string
Hash function for stacktrace by file and function name and line
-
stacktrace
- lfsampler.Location[]
- A stacktrace is just a list of locations
string
Comparates two { sampleCount: integer } by >
-
a
-any
-
b
-any
boolean