linesman

class linesman.ProfilingSession(stats, environ={}, timestamp=None)[source]

The profiling session is used to store long-term information about the profiled call, including generating the complete callgraph based on cProfile’s stats output.

Of special interest is the uuid that it generates to uniquely track this request.

stats:
An instance of pstats.Pstats, usually retrieved by calling getstats() on a cProfile object.
environ:
If specified, this Session will store environ data. This should be the environment setup by the WSGI server (i.e., paster).
timestamp:
If specified, this should mark the beginning of the profiling session–i.e., when Profile.run() was called. This can be any format if your choosing; however, the default templates simply invoke timestamp.__repr__, so whatever object you use should provide at _least_ that function.
uuid[source]

See session_uuid.

linesman.create_graph(stats)[source]

Given an instance of pstats.Pstats, this will use the generated call data to create a graph using the networkx library. Node and edge information is stored in the graph itself, so that the stats object itself–which can’t be pickled–does not need to be kept around.

stats:
An instance of pstats.Pstats, usually retrieved by calling getstats() on a cProfile object.

Returns a networkx.DiGraph containing the callgraph.

linesman.draw_graph(graph, output_path)[source]

Draws a networkx graph to disk using the dot format.

graph:
networkx graph
output_path:
Location to store the rendered output.

Previous topic

Getting Started

Next topic

linesman.backends

This Page