Topic: program statistics

topics > computer science > Group: programming

collecting statistics on a UserInterface
function cost
execution profile
software metrics


Through statistical analysis of programs, researchers have found limited use of most statement types. For instance, in one study 45% of all statements were replacements of which 75% used only a variable or a constant. These studies indicate that language capability seldom matches language use. In a statistical study of machine code, 35% of the code was load instructions for memory access. (cbb 5/80)
Subtopic: sampling up

Quote: use sampling to test for assertion failures across a large user base [»liblB6_2003]
Quote: sample code execution as a Bernoulli process using pre-generated random countdowns; fast path is a decrement, compare, and branch [»liblB6_2003]
Quote: use event counts instead of event traces when sampling over a large user base [»liblB6_2003]

Subtopic: common fragments up

Quote: large program frequently reuse small sequences of instructions
Quote: copy-paste segments of 5-15 lines, 12% copied a function, 2/3 renamed a variable, 1/4 modified a statement [»liZ3_2006]

Subtopic: conditionals vs. lines-of-code up

Quote: for white-box testing, count IF statements instead of LOC; measures the number of executable paths [»yamaT11_1998]

Subtopic: intermediate language vs. source up

Quote: compared intermediate code instead of C code; captures the essential properties of a program [»engbJ5_1999]

Subtopic: program statistics up

Quote: the global coupling of 17 kernel modules grows exponentially with version number; lines of code grows linearly with version number; leads to maintenance issues [»schaSR2_2002]
Quote: program statistics for variables, parameters, assignments, constants, arrays, operators [»cookRP3_1982, OK]
QuoteRef: knutDE1_1971 ;;7 distribution of statement types (FORTRAN) assignment (41-50%), if,goto, call between 14% and 8%, rest small
QuoteRef: alexWG2_1972 ;;15 assignment statements 42% of the time
Quote: in a large Fortran library, 58% of instructions were assignments of which half had no operators and a third one operator [»hennMA7_1980, OK]

Subtopic: inner loops up

QuoteRef: clarBL9_1973 ;;54 Knuth 71 and Alexander 72: typical programs spend > 50% times executing < 4% of code
QuoteRef: knutDE1_1971 ;;13 less than 4% of program uses more than 50% of time

Subtopic: simple vs. complex up

Quote: about 75% of UNIX shell programs consisted of straight-line scripts [»mashJR_1976]
Quote: simple constructs predominate in SAL programs
QuoteRef: knutDE1_1971 ;;9 almost all assignments very simple e.g. a=b or a=b+c e.g., 40% of additions were a+1
QuoteRef: knutDE1_1971 ;;8 95% do loops used increment of 1
QuoteRef: alexWG2_1972 ;;23 equivalence 46% of the time

Subtopic: procedure depth up

QuoteRef: alexWG2_1972 ;;18 80% of procedures one level deep

Subtopic: embedded programs up

Quote: embedded programs use unsigned 8/16-bit data; SpecInt95 programs use signed and unsigned 32-bit data [»engbJ5_1999]
Quote: embedded programs use logic and arithmetic instructions; SpecInt95 programs use 5x as many arithmetic instructions
Quote: 35% of embedded functions are void f(void); i.e., for side effects
Quote: most data (by amount) is global for SpecInt95 and embedded programs [»engbJ5_1999]

Subtopic: machine code statistics up

Quote: statistics from a million Mesa instructions: 17% load immediate, 13% load local, 7% store local, etc. [»sweeRE3_1982, OK]
Quote: collected machine statistics for several months; 35% LOAD, 18% conditional branch, 14% return, 9% arith., 6% jump, 5% STORE [»baraAM3_1978, OK]
Quote: execution statistics of 13% MOVL instructions in compiled VAX code [»wiecCA3_1982, OK]

Related Topics up

Topic: collecting statistics on a UserInterface (12 items)
Topic: function cost (8 items)
Topic: execution profile (43 items)
Topic: software metrics (32 items)
Topic: statistics
(12 items)

Updated barberCB 6/05
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.