Note on operations:
This feature characterizes the proportion of certain operation types in a code region. We define operations to be the binary instructions that make up a high-level instruction. For instance, consider an array access: array[i]
This instruction consists of two operations:
arith:
This feature measures the number of integer arithmetic operations in a code region.
It is the ratio of the number of integer arithmetic operations to the total number of
operations in a code region.
Note: As described above, assume that each memory reference also contains an
integer arithmetic operation - the computation of the address where the base address is
added to an offset.
Classifying arith:
arith can be classified into low, medium or high as follows:
Bucket | Condition |
---|---|
Low | Fewer than 1 out of every 3 operations are integer arithmetic operations. |
Medium | About 1 out of every 3 operations is an integer arithmetic operation. |
High | 1 or more operations out of every 2 are integer arithmetic operations. |
Example 1:
Consider the following code:
for (i=0; i<1000; i++) result[i] = arrayOne[i] * arrayTwo[i];This region of code consists of three memory references and just a single floating point operation in each iteration of the loop in addition to incrementing the loop variable and the evaluating the conditional expression. Therefore, a value of arith estimated for a single loop iteration should hold for all iterations of the loop. Since every second operation is an arithmetic operation, arith can be estimated to be high.
Example 2:
Let's look at another example:
for (i=0; i<1000; i++){ x1 = arrayOne[i].x; y1 = arrayOne[i].y; z1 = arrayOne[i].z; x2 = arrayTwo[i].x; y2 = arrayTwo[i].y; z2 = arrayTwo[i].z; result[i] = sqrtf((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2)); }This region of code contains about 7 memory accesses and a number of other operations in each iteration of the loop. Once more, airth looks to be high.