Perhaps more useful than a profile at the segment level is a
complexity profile at the program unit level. The complexity profile of
program unit P is a composite of the profile metrics of its segments.
The CPG is a histogram visualisation of this composite. For example,
consider the CSD for procedure BinarySearch and its corresponding CPG,
both of which are shown below. While the CSD shows the actual source
code with the while loop and nested if statement depicted graphically,
the CPG shows the complexity of the procedure as a profile of the
individual statements' complexities. The recognisable complexity
density in the CPG indicating the while loop with nested if statement is
a cluster, as defined earlier. This visual representation of
complexity (i.e., profile and cluster) forms the basis for all intended
applications. Therefore, is referred to as the profile metric.
The CPG for a program unit is displayed by plotting values for each segment of the program unit as a histogram. In addition, the
,
,
I(S), R(S), and B(S) graphs can be plotted separately, with or without
scaling, to provide additional complexity profiles. This allows the
user to view the complexity of a program from a desirable perspective.