identifying hotspots in software build processes

Post on 05-Jul-2015

163 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Identifying Hotspots in Software Build Processes

Shane McIntosh

Ahmed E. Hassan

Bram Adams

Meiyappan Nagappan

@shane_mcintoshshanemcintosh@acm.org

Source code

What is a build system?

!2

Source code

Deliverable

What is a build system?

!2

.tex

.c

.cc

.o

.o

.dvi

.a

.exe

.pdf

.deb

Build systems describe how sources are translated into deliverables

!3

(4) Test

(1) Think

(2) Edit

(3) Build

The developer’s work cycle

All builds are equal…

!4

…But some builds are more equal than others

http://xkcd.com/303/

Why is the gtk build so abysmally slow? This hinders our ability to run gtk bots

and keep the gtk build green. :( ”!5

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.olibrary.a

del1.c del2.cutil1.o util2.o

util1.c util2.c

!6

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.olibrary.a

del1.c del2.cutil1.o util2.o

util1.c util2.c

!6

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.olibrary.a

del1.c del2.cutil1.o util2.o

util1.c util2.c

!6

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.olibrary.a

del1.c del2.cutil1.o util2.o

util1.c util2.c

!6

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.olibrary.a

del1.c del2.cutil1.o util2.o

util1.c util2.c

!6

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.olibrary.a

del1.c del2.cutil1.o util2.o

util1.c util2.c

!6

Before refactoring:!4 commands!

triggered

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.olibrary.a

del1.c del2.cutil1.o util2.o

util1.c util2.c

!6

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.o

del1.c del2.c

util1.o util2.o

util1.c util2.c

!7

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.o

del1.c del2.c

util1.o util2.o

util1.c util2.c

!7

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.o

del1.c del2.c

util1.o util2.o

util1.c util2.c

!7

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.o

del1.c del2.c

util1.o util2.o

util1.c util2.c

!7

Refactoring can improve build performance

deliverable1 deliverable2

del1.o del2.o

del1.c del2.c

util1.o util2.o

util1.c util2.c

!7

After refactoring:!2 commands!

triggered

…But where should we focus refactoring effort?

Files that rebuild the slowest?

!8

…But where should we focus refactoring effort?

Files that rebuild the slowest?

…but they may only rarely change!

!8

…But where should we focus refactoring effort?

Files that rebuild the slowest?

Files that change the most often?

…but they may only rarely change!

!8

…But where should we focus refactoring effort?

Files that rebuild the slowest?

Files that change the most often?

…but they may only rarely change!

…but they may already be optimal!

!8

…But where should we focus refactoring effort?

Files that rebuild the slowest?

Files that change the most often?

…but they may only rarely change!

…but they may already be optimal!

Focus on build hotspots:

Files that rebuild slowly and change often

!8

(1)Dependency

Graph Construction

(2)Dependency

GraphAnalysis (3)

Build Hotspot

Detection

Graphanalysis results

(1)Dependency

Graph Construction (3)

Build Hotspot

DetectionQuadrant Plot

Build Activity

File

Chu

rn

(2)Dependency

GraphAnalysisDep. Graph

VersionControlSystem

Hotspot detection approach

!9

MAKAO tool extracts build dependency graphs

(1)Dependency

Graph Construction

(2)Dependency

GraphAnalysis

(3)Build

Hotspot Detection

Design recovery and maintenance of build systems B. Adams, Herman Tromp, Kris De Schutter, Wolfgang De Meuter

[ICSM 2007]

!10

The cost of traversing an edge is derived by timing its build command

(1)Dependency

Graph Construction

(2)Dependency

GraphAnalysis

(3)Build

Hotspot Detection

!11

Median of 10 repetitions

!12

Mining frequently changing files from version control

Terminal

$ git clone … … $ git checkout <some_tag> … $ git log --oneline <some_file>

(1)Dependency

Graph Construction

(2)Dependency

GraphAnalysis

(3)Build

Hotspot Detection

(1)Dependency

Graph Construction

(2)Dependency

GraphAnalysis

(3)Build

Hotspot Detection

Quadrant plots highlight build hotspots

Rebuild cost

Num

ber o

f cha

nges

!13

(1)Dependency

Graph Construction

(2)Dependency

GraphAnalysis

(3)Build

Hotspot Detection

Quadrant plots highlight build hotspots

Rebuild cost

Num

ber o

f cha

nges

!13

(1)Dependency

Graph Construction

(2)Dependency

GraphAnalysis

(3)Build

Hotspot Detection

Quadrant plots highlight build hotspots

Rebuild cost

Num

ber o

f cha

nges

!13

(1)Dependency

Graph Construction

(2)Dependency

GraphAnalysis

(3)Build

Hotspot Detection

Quadrant plots highlight build hotspots

Rebuild cost

Num

ber o

f cha

nges

Refactor

these first!

!13

Open source case studies!!

!

!

Rebuild cost 90 seconds

Number of changes Median

Thresholds

!14

0 750,000 1,500,000 2,250,000 3,000,000

2,752,225

38,102

Build dependency graph properties

0 35,000 70,000 105,000 140,000

60,170

121,710

5,131

3,375

# Nodes# Edges

!15

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●●

●●

●●●

●●

●●

●●●

●●●

●●

●●

●●

●●●

●●

●●●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●●

●●

●●●

●●

●●

●●●

●●

●●●

●●

●●●

●●

●●●

●●

●●

●●

●●●

●●

●●●●●

●●●●

●●

●●

0.25

0.50

0.75

1.00

0 50 100 150Build Time

Nor

mal

ized

File

Chu

rn

Rebuild cost (seconds)

Num

ber o

f cha

nges

(N

orm

aliz

ed)

65 hotspots!(7% of

source files)

!16

glib/glib.hglib/glib-object.h

Main culprits

Max: 148 seconds

Rebuild cost (seconds)

Num

ber o

f cha

nges

(N

orm

aliz

ed)

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●●●

●●

●●●

●●

●●

●●●

●●●

●●

●●●

●●

●●●

●●●●●

●●

●●

●●

●●●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●●●●

●●

●●

●●

●●●●●

●●

●●

●●

●●

●●●

●●●

●●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●●

●●

●●

●●●

●●●

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

●●

●●

●●

●●

●●●●●●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

0.25

0.50

0.75

1.00

0 50 100 150 200Build Time (s)

Nor

mal

ized

File

Chu

rn27 hotspots!

(2% of source files)

!17

postgres.haccess/htup.h

Main culprits

access/genam.haccess/xact.hutils/builtins.h

Max: 191 seconds

Rebuild cost (seconds)

Num

ber o

f cha

nges

(N

orm

aliz

ed)

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●●

●●

●●

●●

●●

●●●●●

●●

●●

●●

●●

●●●

●●●●●

●●

●●

●●

●●●●●●●●●●●

●●●●●●●●●●●

●●●●●●●●●

●●●●●●●●●●●●●●●

●●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●●●●●

●●

●●

●●●●●

●●

●●●●

●●

●●

●●

●●●

●●●

●●

●●●●

●●●●●

●●●●●

●●●●●●●

●●●●●

●●●●●●●●

●●

●●●●●●●●

●●●●●●●

●●●●●●●

●●

●●

●●

●●●●●●●

●●

●●●●●●●●

●●

●●●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●●●

●●

●●

●●

●●

●●●

●●●●●●●●●●●●●

●●●●

●●●

●●

●●

●●

●●

●●●●●●●●●●●●●●

●●●

●●●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●●

●●

●●

●●●

●●●

●●

●●

●●

●●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●●●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●●●

●●

●●●●

●●●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●●

●●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●●

●●

●●●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●●●

●●●●

●●

●●●●

●●

●●●

●●●

●●●●●

●●

●●●●●●

●●

●●

●●●

●●●

●●

●●

●●●

●●●●●

●●●●●

●●●●●

●●

●●●●●●●●

●●●●

●●●●

●●

●●●

●●●

●●●●●●●●●●●●●●●●

●●●

●●

●●●●●●●●●●

●●

●●

●●●●●

●●●●●

●●●●●●

●●●●

●●

●●●●●●●●●●●

●●●●●

●●●●●●●●

●●

●●●●●●

●●●

●●●

●●●

●●●●

●●●●●

●●

●●●●

●●

●●

●●

●●●

●●●●●●

●●●●●

●●

●●●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●●

●●

●●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●●

●●

●●

●●

●●●

●●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●●

●●

●●●●

●●

●●

●●●

●●●●

●●

●●●

●●

●●

●●●●●

●●

●●●

●●

●●●

●●

●●

●●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●●●●●●●●●●●●●

●●

●●●●●

●●

●●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●

●●●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●●

●●

●●

●●

●●●●

●●●

●●●

●●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●●●●

●●●●●

●●

●●●●

●●

●●●●●

●●●●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●

●●

●●●

●●●●

●●

●●

●●

●●●●●●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●●●

●●●

●●

●●●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●●●

●●●

●●

●●

●●●

●●●●●

●●●

●●

●●

●●●

●●

●●●●

●●

●●●●

●●

●●

●●

●●●

●●

●●

●●●●●●●

●●

●●●

●●●

●●●

●●

●●●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●●

●●●

●●

●●

●●●●●

●●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●●

●●●

●●●●●●●●●●●●

●●

●●●●●●●●

●●●

●●

●●

●●●

●●

●●

●●●●●●●●●●●●●

●●●

●●

●●●●●●●●●●

●●●●●●●●●

●●●

●●●

●●

●●

●●●

●●

●●

●●

●●●

●●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●●

●●●●●

●●●

●●

●●

●●●●

●●

●●

●●

●●●

●●

●●●

●●

●●●●

●●

●●

●●●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●●●

●●●●

●●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●●●

●●

●●●

●●

●●●●

●●

●●●

●●●●●●●

●●

●●●●

●●●●●

●●

●●●●●●●●●●●●●●●●●●●●●

●●●●

●●

●●

●●●●

●●

●●●●●●●●●●●●●●●●●●●●●●

●●

●●●●

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

●●

●●●

●●●

●●●●

0.25

0.50

0.75

1.00

0 2000 4000 6000 8000Build Time (s)

Nor

mal

ized

File

Chu

rn 732 hotspots!(8% of source files)

!18

qtxmlpatterns

High hotspot!concentration

qtbase/…/corelib

Main culpritstmtm

Max: 2hrs 19min

hot.c

...1 2

hot.o

nn-1

!19

General trends Transitive property of build hotspots

hot.c

...1 2

hot.o

nn-1

!19

General trends Transitive property of build hotspots

x.h

hot.c

...1 2

hot.o

nn-1

!19

General trends Transitive property of build hotspots

x.h

hot.c

...1 2

hot.o

nn-1

!19

General trends Transitive property of build hotspots

x.h

hot.c

...1 2

hot.o

nn-1

General trends Transitive property of build hotspots

!20

x.h

hot.c

...1 2

hot.o

nn-1

General trends Transitive property of build hotspots

!20

hub.h

x.h

hot.c

...1 2

hot.o

nn-1

General trends Transitive property of build hotspots

!20

hub.h

x.h

hot.c

...1 2

hot.o

nn-1

a.h b.h y.h z.h

General trends Transitive property of build hotspots

!20

hub.h

x.h

hot.c

...1 2

hot.o

nn-1

a.h b.h y.h z.h

General trends Transitive property of build hotspots

!20

hub.h

x.h

hot.c

...1 2

hot.o

nn-1

a.h b.h y.h z.h

General trends Transitive property of build hotspots

!20

hub.h

x.h

hot.c

...1 2

hot.o

nn-1

Limit internal use of “header file hubs” as much as possible!

a.h b.h y.h z.h

General trends Transitive property of build hotspots

!20

@shane_mcintoshshanemcintosh@acm.org

top related