The control flow of each function is partitioned into unique paths (UPs) to provide a small set of measurement points. The motivation for restructuring the control flow into UPs is twofold.
The first aspect, the strategy of instrumenting edges (or vertices where possible), is also fundamental to the aforementioned work on optimal profiling and tracing by Ball and Larus []. It is the second aspect that distinguishes this new approach from their work. The option of performing static analysis on the control flow to determine and optimize the instrumentation code for order-dependent on-the-fly analysis requires the definition of ranges for the analysis. Naively, one could choose basic blocks to comprise these ranges. But it has been demonstrated for profiling and tracing that fewer instrumentation points can be obtained by a more selective instrumentation technique. UPs provide such a framework supporting efficient instrumentation for on-the-fly analysis.
The set of UPs is called a unique path partitioning (UPPA) and is defined as follows: Let G(V,E) be the control-flow graph (directed graph) of a function with a set of edges (transitions) E and a set of vertices (basic blocks) V.
Let p be a path
with the ordered set of edges
and the ordered set of vertices
, i.e., a sequence of distinct
vertices connected by edges []. The edge
may also be denoted as
. Vertex
is called an head vertex and vertex
a tail vertex,
while all other
are internal vertices. Let H be the
set of all head vertices and T be the set of all tail vertices.
The properties 6 and 7 are operational restrictions motivated by the application of the partitioning for on-the-fly analysis of program behavior. The break at calls allows the insertion of instrumentation code for separate compilation. Thus, the compiler is not required to perform interprocedural analysis. The break at loop boundaries ensures that the frequency of events can be identified. The frequency of events outside a loop differs from the frequency inside loops (unless the loop was iterated only once). Thus, a UP associated with an event should not cross loop boundaries.


The significance of the ordering is related to the number of measurement points for on-the-fly analysis. A smaller partitioning yields fewer measurement points, which improves the performance of on-the-fly analysis. The following algorithm provides a method to find a small partitioning. The algorithm uses the terminology of a loop header for a vertex with an incoming edges from outside the loop. A loop exit is a vertex with an outgoing edge leaving the loop. This is illustrated in Figure 2a.

![]()

In terms of the ordering of UPPAs, the basic block partitioning
is the partitioning with the largest number of measurement
points. Algorithm 1 constructs a partitioning that has an
equal or smaller number of measurement points. We found that the
algorithm produces a much smaller UPPA if possible. The algorithm may
in fact produce a minimal UPPA (with the smallest possible number of
measurement points). We have not yet succeeded in proving the
minimality due to the fact that a given graph may have more than one
minimal UPPA.
In summary, the control-flow graph can be transformed into a small UPPA by Algorithm 1. The small set of measurement points is given by a unique vertex or unique edge of each UP. This provides the framework for efficient on-the-fly analysis with regard to the definition of UPPAs.
Another short example for a small UPPA construction shall be given, which is used to discuss the possibility of letting paths begin and end in edges as well as vertices.
![]()
In general, the method may still be further tuned with regard to the
dynamic behavior. Currently, a path has to begin and end in a vertex.
Consider the notion of open paths that can start and end in a
vertex or an edge. Then, another small UPPA of the loop in
Figure 2a would be:
Consider the number of measurement points executed during each loop
iteration. For
, there are two measurement points for an
iteration reaching b1, one each in paths 2 and 3. For
,
there is only one measurement point on b1 in path 3'. The
definition of UPPAs does not take dynamic properties into account.