McGill

Program Size and Structure Metrics

Last updated: December 9, 2002
Sable


Dynamic metrics for program size and structure try to answer the question: how large is a program and how complex is its control structure?



Program Size Metrics

    
Before dynamic loading became commonplace, an approximation of this metric was commonly provided by the size of the executable file. With dynamic loading in place, the program has to be run to obtain a useful measurement of its size. We propose three metrics to characterize a program's run time size, which are progressively more dynamic. Of these three metrics we consider size.run.value the most important in characterizing program size. It is unambiguous, not influenced by dead code, robust and machine-independent. To further simplify, size.run.value can be mapped to a classification in five categories: XS,S,M,L,XL. A program printing "hello world", with 4 byte codes touched, is in the XS category, mtrt, with 7793 byte codes is in the M category, while javac with 23K byte codes is in the L category.


Back to Top


Program Structure Metrics

The following metrics characterize the complexity of program structure by measuring instructions that change control flow (if, switch, invokeVirtual). A program with a single large loop is considered simple, as opposed to a program with multiple loops and/or many control flow changes within a singe loop. Of these metrics, structure.ControlDensity.value characterizes best the complexity of program structure. It is the reciprocal of average basic block size.


Back to Top