l.s.p.profile : module documentation

Part of lp.services.profile

Profile requests when enabled.
Class ProfilingOops Fake exception used to log OOPS information when profiling pages.
Class Profiler No class docstring; 2/4 methods documented
Class Stats Undocumented
Class Profilers A simple subclass to initialize our thread local values.
Function before_traverse Handle profiling when enabled via the profiling.enabled feature flag.
Function start_request Handle profiling when configured as permitted.
Function end_request If profiling is turned on, save profile data for the request.
Function get_desired_profile_actions What does the URL show that the user wants to do about profiling?
Class ProfileNamespace A see-through namespace that handles traversals with ++profile++.
Function _maybe_profile Setup profiling as requested.
Function _make_startswith Return a function that returns true if its argument startswith value
Function _make_endswith Return a function that returns true if its argument endswith value
Function _make_includes Return a function that returns true if its argument includes value
Function _make_condition_function Given DSL string, return dict including function implementing string.
def before_traverse(event):
Handle profiling when enabled via the profiling.enabled feature flag.
@adapter(IStartRequestEvent)
def start_request(event):
Handle profiling when configured as permitted.
def _maybe_profile(event):
Setup profiling as requested.

If profiling is enabled, start a profiler for this thread. If memory profiling is requested, save the VSS and RSS.

If already profiling, this is a no-op.

@adapter(IEndRequestEvent)
def end_request(event):
If profiling is turned on, save profile data for the request.
def get_desired_profile_actions(request):
What does the URL show that the user wants to do about profiling?

Returns a set of actions (comma-separated) if ++profile++ is in the URL. Note that ++profile++ alone without actions is interpreted as the "help" action.

def _make_startswith(value):
Return a function that returns true if its argument startswith value
def _make_endswith(value):
Return a function that returns true if its argument endswith value
def _make_includes(value):
Return a function that returns true if its argument includes value
def _make_condition_function(condition_string):
Given DSL string, return dict including function implementing string.

DSL is very simple. Conditions are separated by semicolons, which represent logical or. Each condition should begin with (case insensitive) "startswith ", "endswith ", or "includes ". The part of the condition after this word and before the next semicolon or end-of-string is the match string, which is case-insensitive and whitespace-normalized.

Returned dict has three elements: the function that implements the DSL, the list of conditions that were included, and the list of conditions that were excluded (because they were not understood).

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.