Path Analysis¶
VyPR records information about the paths taken by monitored functions at runtime. You can use the analysis library to analyse the monitored program’s performance with respect to these paths and various operations you can perform with them.
Preamble¶
Path analysis requires access to the source code of the monitored service. You can tell the analysis library
where to find your service using the set_monitored_service_path
configuration function. You can read more about
this at Configuring VyPR Analysis.
Once the analysis library knows where to find your service’s code, path analysis with VyPR’s analysis library starts one of two ways:
1. You use Observation
instances to determine paths taken by function calls to reach them. In this case,
calling reconstruct_reaching_path
on each Observation
instance will give the path taken to reach that
observation.
2. You use a FunctionCall
instance to determine the path taken through a function by a specific call. In this case,
calling reconstruct_path
on the FunctionCall
instance will give the path taken by that function call. This
case is especially useful when combined with Call Trees.
If you care about Observation
instances, the natural next step is to look at the ObservationCollection
class.
Observation Collections¶
The basis of the analysis library’s path comparison facilities is the ObservationCollection
class.
The idea is that, once you have a list of Observation
objects (Base Classes for Database Objects),
you can form an ObservationCollection
object, which provides methods that reconstruct the paths taken by
the relevant monitored functions to reach the observations given.
-
class
VyPRAnalysis.orm.operations.
ObservationCollection
(observations) A collection of observation objects. Defines methods for transformation to a
PathCollection
object.-
to_paths
(scfg) Based on the relevant Symbolic Control-Flow Graph for the current collection of observations, reconstruct the paths up to each observation through the Symbolic Control-Flow Graph and return a
PathCollection
.
-
Path Collections¶
A PathCollection
instance is obtained by calling the to_paths
method defined on ObservationCollection
instances.
The key method defined on instances of PathCollection
is intersection
.
-
class
VyPRAnalysis.orm.operations.
PathCollection
(paths, scfg, function_name, parametric=False) Models a set of paths, obtained by direct reconstruction or modification of already reconstructed paths.
-
__sub__
(other) Gives a
PartialPathCollection
with path differences.
-
intersection
(starting_vertex=None) Return a
ParametricPathCollection
instance containing the single path resulting from the intersection of all paths in the current collection.
-
Calling intersection
on PathCollection
instances gives a ParametricPathCollection
instance and
calling intersection
on PartialPathCollection
instances gives a PartialParametricPathCollection
instance.
-
class
VyPRAnalysis.orm.operations.
PartialParametricPathCollection
(paths, original_paths, path_parameters, scfg, function_name) Models a collection of paths which all diverge at the same point in the source code, and do not start at the beginning of the monitored function.
-
get_path_parameters
() Get the list of path parameters, which are objects that can be used internally to determine which subpath was taken by a given program path at a specific point in the program.
-
get_subpaths_from_parameter
(path_parameter) Given a
PathParameter
object inpath_parameter
, get the subpath given to it by this parametric path.
-
intersection
() Perform intersection, but such that the parse trees used are generated starting from the beginning of each path (we assume the paths start in the same place).
-
-
class
VyPRAnalysis.orm.operations.
ParametricPathCollection
(paths, original_paths, path_parameters, scfg, function_name) Models a collection of paths, all of which diverge at the same point in the source code and start at the beginning of the monitored function.
Variants of Path Collections¶
-
class
VyPRAnalysis.orm.operations.
PartialPathCollection
(paths, scfg, function_name, parametric=False) Models a collection of paths which do not start from the starting vertex of the Symbolic Control-Flow Graph.
-
intersection
() Perform intersection, but such that the parse trees used are generated starting from the beginning of each path (we assume the paths start in the same place).
-