Title: Impact Analysis
1Impact Analysis
University of SaarlandDepartment of Computer
Science
- Yury Chebiryak
- urriy_at_wjpserver.cs.uni-sb.de
2Impact Analysis
- is often used to assess the effects of a change
after change has been made - is rarely used to predict the effect of change
before it is instantiated
3Techniques
4Dependency-based IA
5Whole Program Path-Based Dynamic Impact Analysis
- James Law
- Gregg Rothermel
6PathImpact
- Dynamic
- Call-based
- Works on binaries
- Relatively low cost
- Relatively low overhead
7Call Graph
8Call Graph
B is changed
9Call Graph
Assumption change in B has a potential impact on
nodes reachable from B
10Execution Traces (ET)
Run M()
ET M
11Execution Traces
Run B()
ET MB
12Execution Traces
Return
ET MBr
13Execution Traces
Run A()
ET MBrA
14Execution Traces
Run C()
ET MBrAC
15Execution Traces
Run D()
ET MBrACD
16Execution Traces
Return
ET MBrACDr
17Execution Traces
Run E()
ET MBrACDrE
18Execution Traces
Return
ET MBrACDrEr
19Execution Traces
Return
ET MBrACDrErr
20Execution Traces
Return
ET MBrACDrErrr
21Execution Traces
Return
ET MBrACDrErrrrx
22Execution Traces II
MBrACDrErrrrx
MBrACDrErrrrxMBGrrrrxMBCFrrrrx
Programs with loops gt very long trace
23SEQUITUR algorithm
- Data compression algorithm by Larus
- Online
- Created grammar reproduces trace exactly
- O(N) running time
- O(N) size in the worst case
- O(log N) size in the best case
- e.g. 2GB trace ? 100 MB
24SEQUITUR algorithm
- algorithm SEQUITUR( S )
- input Execution Trace S
- output Grammar G
- Grammar G
- Rule T
- 1. for each token in S
- 2. append token to end of production for T
- 3. if duplicate digram appears
- 4. if other occurrence is a rule g in G
- 5. replace new digram with non-terminal of g.
- 6. else
- 7. form a new rule and replace duplicate
- 8. digrams with the new non-terminal.
- 9. if any rule in G is used only once
- 10. remove the rule by substituting the
production. - 11. return G
25SEQUITUR example
- ET MBrACDrErrrrxMBGrrrrxMBCFrrrrx
26SEQUITUR example
- ET MBrACDrErrrrxMBGrrrrxMBCFrrrrx
T ? MBrACDrErrrrx
27SEQUITUR example
- ET MBrACDrErrrrxMBGrrrrxMBCFrrrrx
T ? MBrACDrE x 1 ? rr
1
1
28SEQUITUR example
- ET MBrACDrErrrrxMBGrrrrxMBCFrrrrx
T ? MBrACDrE11x 1 ? rr
29SEQUITUR example
- ET MBrACDrErrrrxMBGrrrrxMBCFrrrrx
T ? MBrACDrE11xM 1 ? rr
30SEQUITUR example
- ET MBrACDrErrrrxMBGrrrrxMBCFrrrrx
T ? rACDrE11x 1 ? rr
MB
MB
31SEQUITUR example
- ET MBrACDrErrrrxMBGrrrrxMBCFrrrrx
T ? rACDrE11x 1 ? rr 2 ? MB
2
2
32SEQUITUR example
- ET MBrACDrErrrrxMBGrrrrxMBCFrrrrx
T ? 2rACDrE11x2 1 ? rr 2 ? MB
33SEQUITUR example
- ET MBrACDrErrrrxMBGrrrrxMBCFrrrrx
T ? 2rACDrE113G43CF4rx 1 ? rr 2 ? MB 3 ? x2 4 ?
1r
grammar gt whole path DAG
34Whole path DAG
35PathImpact
36PathImpact
37PathImpact
PathImpact(E) I ?E
I
Returns0
38PathImpact
PathImpact(E) up(T, E)
I E
Returns0
39PathImpact
PathImpact(E) forward(1)
I E
Returns0
40PathImpact
PathImpact(E) forward(r)
I E
Returns0
41PathImpact
PathImpact(E) Returns
I E
Returns0
42PathImpact
PathImpact(E) forward(r)
I E
Returns1
43PathImpact
PathImpact(E) Returns
I E
Returns1
44PathImpact
PathImpact(E) after forward(1)
I E
Returns4
45PathImpact
PathImpact(E) forward(3) -gt x
I E
Returns4
46PathImpact
PathImpact(E) backward(r)
I E
Returns4
Skip0
47PathImpact
PathImpact(E) Skip
I E
Returns4
Skip0
48PathImpact
PathImpact(E) backward(D)-gtSkip--
I E
Returns4
Skip1
49PathImpact
PathImpact(E) backward(C)-gt I I U
C, Returns--
I E
Returns4
Skip0
50PathImpact
PathImpact(E) backward(A)-gt I I U
A, Returns--
I E, C
Returns3
Skip0
51PathImpact
PathImpact(E) backward(r)-gtSkip
I E, C, A
Returns2
Skip0
52PathImpact
PathImpact(E) after backward(2)
I E, C, A, M
Returns1
Skip0
53Chianti A Tool for ChangeImpact Analysis of
Java Programs
- Ophelia Chesley
- Xiaoxia Ren
- Barbara G. Ryder
- Fenil Shah
- Frank Tip
54Chianti high-level concept
- Inputs
- test suite T
- original version of code
- edited version of code
55Chianti high-level concept
- set of interdependent atomic changes A
56Chianti high-level concept
- set of interdependent atomic changes A
- call graph for each test in T
57Chianti high-level concept
- set of interdependent atomic changes A
- call graph for each test in T
- Tґ? T potentially affected by c?A
58Chianti high-level concept
- set of interdependent atomic changes A
- call graph for each test in T
- Tґ? T potentially affected by c?A
- for ti?Tґ determine Aґ?A that may have affected ti
59Chianti high-level concept
- set of interdependent atomic changes A
- call graph for each test in T
- Tґ? T potentially affected by c?A
- for ti?Tґ determine Aґ?A that may have affected ti
determine subset of methods affected by a set of
changes
isolate subset of changes that affect a given
test
60Chianti architecture
61Chianti architecture
62Chianti architecture
63Example original version
- class A
- public A()
- public void foo ()
-
- class B extends A
- public B()
- public void foo()
-
- class C extends A
- public C()
64Example changed version
65Example tests
- class Tests
- public static void test1()
- A a new A()
- a.foo()
-
- public static void test2()
- A a new B()
- a.foo()
-
- public static void test3()
- A a new C()
- a.foo()
-
-
66Review Atomic Changes
Change Description
AC Add an empty class
DC Delete an empty class
AM Add an empty method
DM Delete an empty method
CM Change body of a method
LC Change virtual method lookup
AF Add a field
DF Delete a field
67Review Atomic Changes II
Change Description
CFI Change definition of an instance field initializer
CSFI Change definition of a static field initializer
AI Add an empty instance initializer
DI Delete an empty instance initializer
CI Change definition of an instance initializer
ASI Add an empty static initializer
DSI Delete an empty static initializer
CSI Change definition of a static initializer
68Example Step 1
69Example Step 1
70Example Step 1
71Example Step 1
72Example atomic changes
73Recall high-level concept
- set of interdependent atomic changes A
- call graph for each test in T
- Tґ? T potentially affected by c?A
- for ti?Tґ determine Aґ?A that may have affected ti
74Example affected tests
- A test is affected if its call graph contains
- node that corresponds to CM or DM, or
- edge that corresponds to LC
75Example affected tests
76Example test1
void test1() A a new A() a.foo()
77Example test2
void test2() A a new B() a.foo()
78Example test3
void test3() A a new C() a.foo()
79Recall high-level concept
- set of interdependent atomic changes A
- call graph for each test in T
- Tґ? T potentially affected by c?A
- for ti?Tґ determine Aґ?A that may have affected ti
80Example affecting changes
- The set of atomic changes that affect a given
affected test includes - all atomic changes for nodes with AM and CM,
- atomic changes in LC category, and
- their transitively prerequisite atomic changes
81Example affecting changes
82Example AffectingChanges(test2)
83Example AffectingChanges(test2)
84Example
Remember the atomic change
This atomic change does not affect any of the
tests gt additional tests are needed.
85Snapshot
86Chianti Evaluation
Number of atomic changes between each pair of
Daikon versions.
87Chianti Evaluation
Categorization of the atomic changes.
88Chianti Evaluation
Percentage of affected tests for each of the
Daikon versions.
89Chianti Evaluation
Average percentage of affecting changes, per
affected test.
90Summary
- PathImpact
- dynamic uses dynamic traces
- online
- works on binaries
- Chianti
- uses dynamic call graphs
- applicable for OOP (e.g. Java)
- determines affecting changes for every test
91References
- 1 Chesley, O., Dolby, J., Ren, X., Ryder, B.,
Shah, F., and Tip, F. Chianti A prototype change
impact analysis tool for Java. Tech. Rep.
DCS-TR-533, Rutgers University Department of
Computer Science, September 2003. - 2 Chesley, O., Ren, X., Ryder, B., Shah, F.,
and Tip, F. Chianti a tool for change impact
analysis of java programs. In Proceedings of the
19th annual ACM SIGPLAN Conference on
Object-oriented programming, systems, languages,
and applications, pp. 432?448. - 3 Law, J., Rothermel, G. Whole program
Path-Based dynamic impact analysis. In Proc. of
the 25th International Conference on Software
Engineering, May 03-10, 2003, Portland, Oregon. - 4 Ryder, B., Tip, F. Change impact analysis for
object-oriented programs. In Proceedings of the
2001 ACM SIGPLAN-SIGSOFT workshop on Program
analysis for software tools and engineering, pp.
46?53, June 2001, Snowbird, Utah, United States.
92Thanks for listening.Questions?