Presentation is loading. Please wait.

Presentation is loading. Please wait.

Impact Analysis Yury Chebiryak University of Saarland Department of Computer Science.

Similar presentations


Presentation on theme: "Impact Analysis Yury Chebiryak University of Saarland Department of Computer Science."— Presentation transcript:

1 Impact Analysis Yury Chebiryak University of Saarland Department of Computer Science

2 2/96 Impact 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

3 3/96 Techniques

4 4/96 Dependency-based IA

5 Whole Program Path-Based Dynamic Impact Analysis James Law Gregg Rothermel

6 6/96 PathImpact Dynamic Call-based Works on binaries Relatively low cost Relatively low overhead

7 7/96 Call Graph

8 8/96 Call Graph B is changed

9 9/96 Call Graph Assumption: change in B has a potential impact on nodes reachable from B

10 10/96 Execution Traces (ET) Run M() ET: M

11 11/96 Execution Traces Run B() ET: MB

12 12/96 Execution Traces Return ET: MBr

13 13/96 Execution Traces ET: MBrA Run A()

14 14/96 Execution Traces Run C() ET: MBrAC

15 15/96 Execution Traces Run D() ET: MBrACD

16 16/96 Execution Traces Return ET: MBrACDr

17 17/96 Execution Traces Run E() ET: MBrACDrE

18 18/96 Execution Traces Return ET: MBrACDrEr

19 19/96 Execution Traces Return ET: MBrACDrErr

20 20/96 Execution Traces Return ET: MBrACDrErrr

21 21/96 Execution Traces Return ET: MBrACDrErrrrx

22 22/96 Execution Traces II Single Multiple MBrACDrErrrrx MBrACDrErrrrxMBGrrrrxMBCFrrrrx Programs with loops => very long trace

23 23/96 SEQUITUR 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

24 24/96 SEQUITUR 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

25 25/96 SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx

26 26/96 SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → MBrACDrErrrrx

27 27/96 SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → MBrACDrE x 1 → rr 11

28 28/96 SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → MBrACDrE11x 1 → rr

29 29/96 SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → MBrACDrE11xM 1 → rr

30 30/96 SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → rACDrE11x 1 → rr MB

31 31/96 SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → rACDrE11x 1 → rr 2 → MB 22

32 32/96 SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → 2rACDrE11x2 1 → rr 2 → MB

33 33/96 SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → 2rACDrE113G43CF4rx 1 → rr 2 → MB 3 → x2 4 → 1r grammar => whole path DAG

34 34/96 Whole path DAG

35 35/96 PathImpact

36 36/96 PathImpact

37 37/96 PathImpact PathImpact(E): I  {E} I = {}Returns=0

38 38/96 PathImpact PathImpact(E): up(T, E)I = {E}Returns=0

39 39/96 PathImpact PathImpact(E): forward(1)I = {E}Returns=0

40 40/96 PathImpact PathImpact(E): forward(r)I = {E}Returns=0

41 41/96 PathImpact PathImpact(E): Returns++I = {E}Returns=0

42 42/96 PathImpact PathImpact(E): forward(r)I = {E}Returns=1

43 43/96 PathImpact PathImpact(E): Returns++I = {E}Returns=1

44 44/96 PathImpact PathImpact(E): after forward(1)I = {E}Returns=4

45 45/96 PathImpact PathImpact(E): forward(3) -> xI = {E}Returns=4

46 46/96 PathImpact PathImpact(E): backward(r)I = {E}Returns=4 Skip=0

47 47/96 PathImpact PathImpact(E): Skip++I = {E}Returns=4 Skip=0

48 48/96 PathImpact PathImpact(E): backward(D)->Skip--I = {E}Returns=4 Skip=1

49 49/96 PathImpact PathImpact(E): backward(C)-> I := I U {C}, Returns-- I = {E}Returns=4 Skip=0

50 50/96 PathImpact PathImpact(E): backward(A)-> I := I U {A}, Returns-- I = {E, C}Returns=3 Skip=0

51 51/96 PathImpact PathImpact(E): backward(r)->Skip++I = {E, C, A}Returns=2 Skip=0

52 52/96 PathImpact PathImpact(E): after backward(2)I = {E, C, A, M}Returns=1 Skip=0

53 Chianti: A Tool for Change Impact Analysis of Java Programs Ophelia Chesley Xiaoxia Ren Barbara G. Ryder Fenil Shah Frank Tip

54 54/96 Chianti: high-level concept Inputs: 1) test suite T 2) original version of code 3) edited version of code

55 55/96 Chianti: high-level concept 1) set of interdependent atomic changes A

56 56/96 Chianti: high-level concept 1) set of interdependent atomic changes A 2) call graph for each test in T

57 57/96 Chianti: high-level concept 1) set of interdependent atomic changes A 2) call graph for each test in T 3) T´  T – potentially affected by c  A

58 58/96 Chianti: high-level concept 1) set of interdependent atomic changes A 2) call graph for each test in T 3) T´  T – potentially affected by c  A 4) for t i  T´ determine A´  A that may have affected t i

59 59/96 Chianti: high-level concept 1) set of interdependent atomic changes A 2) call graph for each test in T 3) T´  T – potentially affected by c  A 4) for t i  T´ determine A´  A that may have affected t i determine subset of methods affected by a set of changes isolate subset of changes that affect a given test

60 60/96 Chianti: architecture

61 61/96 Chianti: architecture

62 62/96 Chianti: architecture

63 63/96 Example: original version class A{ public A() {} public void foo (){} } class B extends A{ public B(){} public void foo(){} } class C extends A{ public C(){} }

64 64/96 Example: changed version

65 65/96 Example: 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(); }

66 66/96 Review: Atomic Changes ChangeDescription ACAdd an empty class DCDelete an empty class AMAdd an empty method DMDelete an empty method CMChange body of a method LCChange virtual method lookup AFAdd a field DFDelete a field

67 67/96 Review: Atomic Changes II ChangeDescription 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

68 68/96 Example: Step 1

69 69/96 Example: Step 1

70 70/96 Example: Step 1

71 71/96 Example: Step 1

72 72/96 Example: atomic changes

73 73/96 Recall: high-level concept 1) set of interdependent atomic changes A 2) call graph for each test in T 3) T´  T – potentially affected by c  A 4) for t i  T´ determine A´  A that may have affected t i

74 74/96 Example: affected tests A test is affected if its call graph contains: 1) node that corresponds to CM or DM, or 2) edge that corresponds to LC

75 75/96 Example: affected tests

76 76/96 Example: test 1 void test1(){ A a = new A(); a.foo();}

77 77/96 Example: test 2 void test2(){ A a = new B(); a.foo();}

78 78/96 Example: test 3 void test3(){ A a = new C(); a.foo();}

79 79/96 Recall: high-level concept 1) set of interdependent atomic changes A 2) call graph for each test in T 3) T´  T – potentially affected by c  A 4) for t i  T´ determine A´  A that may have affected t i

80 80/96 Example: affecting changes The set of atomic changes that affect a given affected test includes: 1) all atomic changes for nodes with AM and CM, 2) atomic changes in LC category, and 3) their transitively prerequisite atomic changes

81 81/96 Example: affecting changes

82 82/96 Example: AffectingChanges(test 2 )

83 83/96 Example: AffectingChanges(test 2 )

84 84/96 Example This atomic change does not affect any of the tests => additional tests are needed. Remember the atomic change:

85 85/96 Snapshot

86 86/96 Chianti: Evaluation Number of atomic changes between each pair of Daikon versions.

87 87/96 Chianti: Evaluation Categorization of the atomic changes.

88 88/96 Chianti: Evaluation Percentage of affected tests for each of the Daikon versions.

89 89/96 Chianti: Evaluation Average percentage of affecting changes, per affected test.

90 90/96 Summary 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

91 91/96 References [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 [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.

92 92/96 Thanks for listening. Questions?


Download ppt "Impact Analysis Yury Chebiryak University of Saarland Department of Computer Science."

Similar presentations


Ads by Google