Cube supports three kinds of derived metrics:

Prederived inclusive, Prederived exclusive and Postderived

Difference between those metrics is in the place related to the aggregation, where the derivation appears.

- Prederived metric - derivation (calculation of the arithmetical expression) is done before of the aggregation in GUI

- Postderived metric - derivation (calculation of the arithmetical expression) is done after of the aggregation in GUI


Example 1:

Given are metrics "Number of cache misses" and "Time".

One would like to calculate "Rate of the cache misses"
The calculation expression is :
                   (CM1 + CM2 + ...)/(Time1 + Time2 + ...),
where:
CM1, CM, ... - number of cache misses in the callpath 1, callpath 2 and so on
Time1, Time2, ... - time spend in the callpath 1, callpath 2 and so on

Result is the value of the cache misses rate for the aggregated callpath (over system tree, or sub call path, or how else)
From the expression is easy to see, that the evaluation of the expression happens after the aggregation
-> Therefore one uses POSTDERIVED metric with the expression
                   metric::cm()/metric::time()


Example 2:

Given is metric "Time".

One would like to calculate time spend in MPI Regions
The calculation expression is :
                  {
                   if (${calculation::region::name} =~ /^MPI_/)
                      { ${time}=metric::time(); }
                   else
                      { ${time}=0; } ;
                   return ${time};
                  }
where:
${calculation::region::name} -automatic created variable, storing the name of he currently calculation region.
For the list of the automatic variables please see Cube User Guide.

As aggregated value one would like to have normal summation over system tree, or sub call path.

From that it is easy to see, that the evaluation of the expression should happen before the aggregation
-> Therefore one uses PREDERIVED metric.

Value of prederived metrics can be observed being inclusive or exclusive related to the call path.