24
SPEC Workshop 2008 Laboratory for Computer Architecture 1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University of Texas - Austin 1/27/2008

SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

Embed Size (px)

Citation preview

Page 1: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

Laboratory for Computer Architecture 1/27/2008

On the Object Orientedness of C++ programs in SPEC CPU 2006

Ciji Isen & Lizy K. JohnUniversity of Texas - Austin

1/27/2008

Page 2: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

2 Laboratory for Computer Architecture 1/27/2008

Introduction

Object Oriented programming encourages

– Code modularity, ease of design & maintenance– Inheritance & hierarchies

– polymorphism

– Dynamic Dispatch

Should imply

– Multiple function invocation

– More functions

– More indirect branching

Increased control flow

– particularly function calls and indirect branches

Page 3: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

3 Laboratory for Computer Architecture 1/27/2008

Objective

Object oriented nature of SPEC CPU2006 C++ programs

– Measure using quantifiable metrics

– Compare with other OO(SPEC java) benchmarks

Has OO nature affected control flow?

– branch compositions

– Branch misprediction

Page 4: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

4 Laboratory for Computer Architecture 1/27/2008

C++ programs in SPEC cpu06

Page 5: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

5 Laboratory for Computer Architecture 1/27/2008

Methodology

Performance counters

– Woodcrest(Intel), Power5+(IBM)

Benchmarks

– SPEC CPU 2006

– SPEC jbb2000

– SPECjvm98

Principle Component Analysis for Visualization

Page 6: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

6 Laboratory for Computer Architecture 1/27/2008

Object Oriented metrics

CK (Chidamber and Kemerrer) metrics

– WMC (Weighted Methods per Class)

– DIT (Depth of Inheritance Tree)

– NOC (Number of Children)

– CBO (Coupling Between Objects)

– RFC (Response for a Class)

Page 7: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

7 Laboratory for Computer Architecture 1/27/2008

WMC (Weighted Methods per Class)

if complexity is unity

WMC = n

Intuition: More methods implies

– more time & effort to develop and maintain class

– More methods inherited by children => more impact on children

– Likely to be more application specific => less reuse

Page 8: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

8 Laboratory for Computer Architecture 1/27/2008

DIT (Depth of Inheritance Tree)

A measure of impact of ancestor classes

Intuition: deeper class hierarchy implies

– More methods inherited => more complexity

– Greater design complexity

– Greater potential to reuse inherited methods

Page 9: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

9 Laboratory for Computer Architecture 1/27/2008

NOC (Number of Children)

Definition: Number of immediate subclasses

Intuition: more children implies

– Greater reuse

– more influence on the design

Page 10: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

10 Laboratory for Computer Architecture 1/27/2008

CBO (Coupling Between Objects)

Definition: The number of other classes to which a class is coupled

– Via methods

– Instance variables

Intuition: more coupling implies

– Bad for modularity. Less independence for class => difficult to reuse

– Less independence => sensitive to change in other parts

– More interaction => complexity in testing correctness

Page 11: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

11 Laboratory for Computer Architecture 1/27/2008

RFC (Response for a Class)

Intuition: more methods executed per message implies

– More complexity for the class

– Complexity in testing and debugging

Page 12: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

12 Laboratory for Computer Architecture 1/27/2008

Object Orientedness of C++ benchmarks in cpu06

Page 13: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

13 Laboratory for Computer Architecture 1/27/2008

Object Orientedness of C++ benchmarks in cpu06

Page 14: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

14 Laboratory for Computer Architecture 1/27/2008

Object Orientedness of C++ vs. java benchmarks

[DaCapo paper]

Page 15: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

15 Laboratory for Computer Architecture 1/27/2008

Object Orientedness of C++ vs. java benchmarks

Page 16: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

16 Laboratory for Computer Architecture 1/27/2008

Control flow Characteristics

Has OO nature affected control flow?

– branch compositions

– Branch misprediction

Page 17: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

17 Laboratory for Computer Architecture 1/27/2008

Branch types - INT

Page 18: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

18 Laboratory for Computer Architecture 1/27/2008

Branch types - FP

Page 19: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

19 Laboratory for Computer Architecture 1/27/2008

Branch types - INT

Page 20: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

20 Laboratory for Computer Architecture 1/27/2008

Branch types - FP

Page 21: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

21 Laboratory for Computer Architecture 1/27/2008

Branch misprediction - INT

Page 22: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

22 Laboratory for Computer Architecture 1/27/2008

Branch misprediction - FP

Page 23: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

23 Laboratory for Computer Architecture 1/27/2008

Summary

Increased presence of C++ in SPEC CPU encouraging

Measured object orientedness of C++ programs

– Xalanckbmk,dealII & omnetpp – strong OO

– OO nature of C++ programs not any worse than SPEC Java benchmarks

Analyzed impact of OO nature on control flow

– Control flow increase pronounced for FP

– Xalanckbmk, dealII & omnetpp – higher % of function calls and indirect branches

Page 24: SPEC Workshop 2008 Laboratory for Computer Architecture1/27/2008 On the Object Orientedness of C++ programs in SPEC CPU 2006 Ciji Isen & Lizy K. John University

SPEC Workshop 2008

24 Laboratory for Computer Architecture 1/27/2008

Questions

24 Laboratory for Computer Architecture 8/28/2007