Class FunctionProbes
Sibling to CoverageDisplayName and ConstructMetrics, which it calls: the registration is always
the five-argument enterFunction (identity, display name, source file, start line and the phase-5 metrics),
and the probes are always the same three - the coverage FUNCTION_ENTRY, the PROFILING_ENTRY after
it, and the PROFILING_EXIT before the return. Before this there were five copies (an explicit body, the
aggregate and service wraps of synthesised members, the text wrap and an application's _prepare); the
application's registered with no metrics, its _decommission was not registered at all, and the copies
disagreed on which members they skipped.
Two shapes use it. A body generated with its probes in place (OperationDfnGenerator, an application)
calls enter(CoverageProbePlacer, ISymbol, DebugInfo) before generating the body - so the body's own statement and branch probes belong to this
function - places FunctionProbes.Registered.entryProbes() first and FunctionProbes.Registered.profilingExit() before its return.
A body generated elsewhere and instrumented afterwards (a synthesised member, a text method) calls enter(CoverageProbePlacer, ISymbol, DebugInfo)
and then wrap(List, FunctionProbes.Registered, IRInstr). Either way the caller ends the function with exitFunction(endLine); the end line is
the caller's to know. Which synthesised members get probes at all is IsInstrumentedMember. Hold an
instance.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe probes of one registered function; each is null when its kind of instrumentation is off. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionenter(CoverageProbePlacer placer, ISymbol operation, DebugInfo debugInfo) THE registration of a callable with the probe placer, and its three probes.wrap(List<IRInstr> body, FunctionProbes.Registered probes, IRInstr beforeReturn) A body generated without probes, instrumented afterwards: the entry probes first, then the body, withbeforeReturn(if any) and then the profiling exit before every top-levelRETURN.
-
Constructor Details
-
FunctionProbes
public FunctionProbes()
-
-
Method Details
-
enter
public FunctionProbes.Registered enter(CoverageProbePlacer placer, ISymbol operation, DebugInfo debugInfo) THE registration of a callable with the probe placer, and its three probes. Everything about the function - its identity, its display name, its metrics - is read from the symbol here, and nowhere else.- Parameters:
placer- the module's probe placeroperation- the callable being instrumenteddebugInfo- where it starts (null gives no file and line 0)- Returns:
- its probes; the caller must end the function with
placer.exitFunction(endLine)
-
wrap
public List<IRInstr> wrap(List<IRInstr> body, FunctionProbes.Registered probes, IRInstr beforeReturn) A body generated without probes, instrumented afterwards: the entry probes first, then the body, withbeforeReturn(if any) and then the profiling exit before every top-levelRETURN.- Parameters:
body- the body's instructionsprobes- the function's registered probesbeforeReturn- a further probe of this function to place before each return, or null- Returns:
- the instrumented instructions
-