SlideShare una empresa de Scribd logo
1 de 27
Estimating Path Execution Frequency StaticallyRay Buse
Wes Weimer
THE ROAD NOT TAKENICSE 2009
Vancouver, BC
2
The Big Idea
 Developers often have a expectations about
common and uncommon cases in programs
 The structure of code they write can sometimes
reveal these expectations
3
Example
public V function(K k , V v)
{
if ( v == null )
throw new Exception();
if ( c == x )
r();
i = k.h();
t[i] = new E(k, v);
c++;
return v;
}
4
Example
public V function(K k , V v)
{
if ( v == null )
throw new Exception();
if ( c == x )
restructure();
i = k.h();
t[i] = new E(k, v);
c++;
return v;
}
Exception
Invocation that changes
a lot of the object state
Some
computation
5
Path 1
public V function(K k , V v)
{
if ( v == null )
throw new Exception();
if ( c == x )
restructure();
i = k.h();
t[i] = new E(k, v);
c++;
return v;
}
6
public V function(K k , V v)
{
if ( v == null )
throw new Exception();
if ( c == x )
restructure();
i = k.h();
t[i] = new E(k, v);
c++;
return v;
}
Path 2
7
Path 3
public V function(K k , V v)
{
if ( v == null )
throw new Exception();
if ( c == x )
restructure();
i = k.h();
t[i] = new E(k, v);
c++;
return v;
}
8
HashTable: put
public V put(K key , V value)
{
if ( value == null )
throw new Exception();
if ( count >= threshold )
rehash();
index = key.hashCode() % length;
table[index] = new Entry(key, value);
count++;
return value;
}
*simplified from java.util.HashTable jdk6.0
9
Intuition
How a path modifies program state may correlate
with it’s runtime execution frequency
 Paths that change a lot of state are rare
 Exceptions, initialization code, recovery code etc
 Common paths tend to change a small amount
of state
Stack State +
Heap State
10
More Intuition
 Number of branches
 Number of method invocations
 Length
 Percentage of statements in a method executed
 …
11
Hypothesis
We can accurately predict the runtime frequency of
program paths by analyzing their static surface
features
Goals:
 Know what programs are likely to do without
having to run them (Produce a static profile)
 Understand the factors that are predictive of
execution frequency
12
Our Path
 Intuition
 Candidates for static profiles
 Our approach
 a descriptive model of path
frequency
 Some Experimental Results
13
Applications for Static Profiles
 Indicative (dynamic) profiles are often hard to get
Profile information can improve many analyses
 Profile guided optimization
 Complexity/Runtime estimation
 Anomaly detection
 Significance of difference between program
versions
 Prioritizing output from other static analyses
14
Approach
 Model path with a set of features that
may correlate with runtime path
frequency
 Learn from programs for which we have
indicative workloads
 Predict which paths are most or
least likely in other programs
15
Experimental Components
 Path Frequency Counter
 Input: Program, Input
 Output: List of paths + frequency count for each
 Descriptive Path Model
 Classifier
16
Our Definition of Path
 Statically enumerating full program paths doesn't
scale
 Choosing only intra-method paths doesn't give us
enough information
 Compromise: Acyclic Intra-Class Paths
 Follow execution from public method entry point until
return from class
 Don’t follow back edges
17
Experimental Components
 Path Frequency Counter
 Input: Program, Input
 Output: List of paths + frequency count for each
 Descriptive Path Model
 Input: Path
 Output: Feature Vector describing the path
 Classifier
18
Count Coverage Feature
• pointer comparisons
• new
• this
• all variables
• assignments
• dereferences
• • fields
• • fields written
• • statements in invoked method
• goto stmts
• if stmts
• local invocations
• • local variables
• non-local invocations
• • parameters
• return stmts
• statements
• throw stmts
19
Experimental Components
 Path Frequency Counter
 Input: Program, Input
 Output: List of paths + frequency count for each
 Descriptive Path Model
 Input: Path
 Output: Feature Vector describing the path
 Classifier
 Input: Feature Vector
 Output: Frequency Estimate
20
Classifier: Logistic Regression
 Learn a logistic function to estimate the
runtime frequency of a path
Likely to
be taken
Not likely to
be taken
Input path {x1, x2 … xn}
21
Model Evaluation
 Use the model to rank all static paths in the
program
 Measure how much of total program runtime is
spent:
 On the top X paths for each method
 On the top X% of all paths
 Also, compare to static branch predictors
 Cross validation on Spec JVM98 Benchmarks
 When evaluating on one, train on the others
22
Evaluation: Top Paths
Choose 5% of all
paths and get 50% of
runtime behavior
Choose 1 path per
method and get 94%
of runtime behavior
23
Evaluation: Static Branch Predictor
We are even a
reasonable choice for
static branch prediction
Branch Taken;
Forward Not Taken
A set of
heuristics
Always choose the
higher frequency path
24
Model Analysis: Feature Power
Exceptions are
predictive but rare
Many
features “tie”
Path length matters
most
More assignment
statements → lower
frequency
25
Conclusion
A formal model that statically predicts relative
dynamic path execution frequencies
A generic tool (built using that model) that takes only
the program source code (or bytecode) as input
and produces
 for each method, an ordered list of paths through that
method
The promise of helping other program analyses and
transformations
26
Questions? Comments?
27
Evaluation by Benchmark
1.0 = perfect
0.67 = return all or
return nothing

Más contenido relacionado

La actualidad más candente

Dissertation Defense
Dissertation DefenseDissertation Defense
Dissertation DefenseSung Kim
 
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)Sung Kim
 
White Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR ChandigarhWhite Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR ChandigarhPankaj Thakur
 
Software Quality Testing
Software Quality TestingSoftware Quality Testing
Software Quality TestingKiran Kumar
 
Chapter 8 software testing
Chapter 8 software testingChapter 8 software testing
Chapter 8 software testingdespicable me
 
Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Rogue Wave Software
 
TMPA-2017: 5W+1H Static Analysis Report Quality Measure
TMPA-2017: 5W+1H Static Analysis Report Quality MeasureTMPA-2017: 5W+1H Static Analysis Report Quality Measure
TMPA-2017: 5W+1H Static Analysis Report Quality MeasureIosif Itkin
 
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...Sung Kim
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing TechniquesKiran Kumar
 
Unit 3 Control Flow Testing
Unit 3   Control Flow TestingUnit 3   Control Flow Testing
Unit 3 Control Flow Testingravikhimani
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow TestingHirra Sultan
 
Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...The University of Adelaide
 
White Box Testing
White Box TestingWhite Box Testing
White Box TestingAlisha Roy
 
Measuring maintainability; software metrics explained
Measuring maintainability; software metrics explainedMeasuring maintainability; software metrics explained
Measuring maintainability; software metrics explainedDennis de Greef
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing TechniquesKiran Kumar
 

La actualidad más candente (20)

Dissertation Defense
Dissertation DefenseDissertation Defense
Dissertation Defense
 
Path Testing
Path TestingPath Testing
Path Testing
 
Path testing
Path testingPath testing
Path testing
 
10 software testing_technique
10 software testing_technique10 software testing_technique
10 software testing_technique
 
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)
 
White Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR ChandigarhWhite Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR Chandigarh
 
Software Quality Testing
Software Quality TestingSoftware Quality Testing
Software Quality Testing
 
Chapter 8 software testing
Chapter 8 software testingChapter 8 software testing
Chapter 8 software testing
 
Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours?
 
TMPA-2017: 5W+1H Static Analysis Report Quality Measure
TMPA-2017: 5W+1H Static Analysis Report Quality MeasureTMPA-2017: 5W+1H Static Analysis Report Quality Measure
TMPA-2017: 5W+1H Static Analysis Report Quality Measure
 
White box testing
White box testingWhite box testing
White box testing
 
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
 
Unit 3 Control Flow Testing
Unit 3   Control Flow TestingUnit 3   Control Flow Testing
Unit 3 Control Flow Testing
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow Testing
 
Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...
 
White Box Testing
White Box TestingWhite Box Testing
White Box Testing
 
Unit1
Unit1Unit1
Unit1
 
Measuring maintainability; software metrics explained
Measuring maintainability; software metrics explainedMeasuring maintainability; software metrics explained
Measuring maintainability; software metrics explained
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
 

Destacado

A Metric for Code Readability
A Metric for Code ReadabilityA Metric for Code Readability
A Metric for Code ReadabilityRay Buse
 
PhD Proposal talk
PhD Proposal talkPhD Proposal talk
PhD Proposal talkRay Buse
 
Documentation Inference for Exceptions
Documentation Inference for ExceptionsDocumentation Inference for Exceptions
Documentation Inference for ExceptionsRay Buse
 
Automatically Documenting Program Changes
Automatically Documenting Program ChangesAutomatically Documenting Program Changes
Automatically Documenting Program ChangesRay Buse
 
Synthesizing API Usage Examples
Synthesizing API Usage Examples Synthesizing API Usage Examples
Synthesizing API Usage Examples Ray Buse
 
Analytics for Software Development
Analytics for Software DevelopmentAnalytics for Software Development
Analytics for Software DevelopmentRay Buse
 
Automatically Describing Program Structure and Behavior (PhD Defense)
Automatically Describing Program Structure and Behavior (PhD Defense)Automatically Describing Program Structure and Behavior (PhD Defense)
Automatically Describing Program Structure and Behavior (PhD Defense)Ray Buse
 
MSR End of Internship Talk
MSR End of Internship TalkMSR End of Internship Talk
MSR End of Internship TalkRay Buse
 
Information Needs for Software Development Analytics
Information Needs for Software Development AnalyticsInformation Needs for Software Development Analytics
Information Needs for Software Development AnalyticsRay Buse
 

Destacado (9)

A Metric for Code Readability
A Metric for Code ReadabilityA Metric for Code Readability
A Metric for Code Readability
 
PhD Proposal talk
PhD Proposal talkPhD Proposal talk
PhD Proposal talk
 
Documentation Inference for Exceptions
Documentation Inference for ExceptionsDocumentation Inference for Exceptions
Documentation Inference for Exceptions
 
Automatically Documenting Program Changes
Automatically Documenting Program ChangesAutomatically Documenting Program Changes
Automatically Documenting Program Changes
 
Synthesizing API Usage Examples
Synthesizing API Usage Examples Synthesizing API Usage Examples
Synthesizing API Usage Examples
 
Analytics for Software Development
Analytics for Software DevelopmentAnalytics for Software Development
Analytics for Software Development
 
Automatically Describing Program Structure and Behavior (PhD Defense)
Automatically Describing Program Structure and Behavior (PhD Defense)Automatically Describing Program Structure and Behavior (PhD Defense)
Automatically Describing Program Structure and Behavior (PhD Defense)
 
MSR End of Internship Talk
MSR End of Internship TalkMSR End of Internship Talk
MSR End of Internship Talk
 
Information Needs for Software Development Analytics
Information Needs for Software Development AnalyticsInformation Needs for Software Development Analytics
Information Needs for Software Development Analytics
 

Similar a Estimating Path Execution Frequency Statically Using Static Analysis

Efficient JavaScript Mutation Testing
Efficient JavaScript Mutation TestingEfficient JavaScript Mutation Testing
Efficient JavaScript Mutation TestingSALT Lab @ UBC
 
7-White Box Testing.ppt
7-White Box Testing.ppt7-White Box Testing.ppt
7-White Box Testing.pptHirenderPal
 
Reverse Engineering automation
Reverse Engineering automationReverse Engineering automation
Reverse Engineering automationPositive Hack Days
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis Engineering Software Lab
 
Artificial software diversity: automatic synthesis of program sosies
Artificial software diversity: automatic synthesis of program sosiesArtificial software diversity: automatic synthesis of program sosies
Artificial software diversity: automatic synthesis of program sosiesFoCAS Initiative
 
Compiler Construction for DLX Processor
Compiler Construction for DLX Processor Compiler Construction for DLX Processor
Compiler Construction for DLX Processor Soham Kulkarni
 
New software testing-techniques
New software testing-techniquesNew software testing-techniques
New software testing-techniquesFincy V.J
 
SE2023 0401 Software Coding and Testing.pptx
SE2023 0401 Software Coding and Testing.pptxSE2023 0401 Software Coding and Testing.pptx
SE2023 0401 Software Coding and Testing.pptxBharat Chawda
 
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systemsTMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systemsIosif Itkin
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineeringpoonam.rwalia
 
Software testing strategies
Software testing strategiesSoftware testing strategies
Software testing strategiesKrishna Sujeer
 
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTINGA WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTINGJournal For Research
 
connecting discrete mathematics and software engineering
connecting discrete mathematics and software engineeringconnecting discrete mathematics and software engineering
connecting discrete mathematics and software engineeringRam Kumar K R
 

Similar a Estimating Path Execution Frequency Statically Using Static Analysis (20)

Efficient JavaScript Mutation Testing
Efficient JavaScript Mutation TestingEfficient JavaScript Mutation Testing
Efficient JavaScript Mutation Testing
 
7-White Box Testing.ppt
7-White Box Testing.ppt7-White Box Testing.ppt
7-White Box Testing.ppt
 
Reverse Engineering automation
Reverse Engineering automationReverse Engineering automation
Reverse Engineering automation
 
Debug me
Debug meDebug me
Debug me
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
 
Artificial software diversity: automatic synthesis of program sosies
Artificial software diversity: automatic synthesis of program sosiesArtificial software diversity: automatic synthesis of program sosies
Artificial software diversity: automatic synthesis of program sosies
 
Compiler Construction for DLX Processor
Compiler Construction for DLX Processor Compiler Construction for DLX Processor
Compiler Construction for DLX Processor
 
Static Analysis and Verification of C Programs
Static Analysis and Verification of C ProgramsStatic Analysis and Verification of C Programs
Static Analysis and Verification of C Programs
 
New software testing-techniques
New software testing-techniquesNew software testing-techniques
New software testing-techniques
 
SWE-6 TESTING.pptx
SWE-6 TESTING.pptxSWE-6 TESTING.pptx
SWE-6 TESTING.pptx
 
Defense
DefenseDefense
Defense
 
Defense
DefenseDefense
Defense
 
SE2023 0401 Software Coding and Testing.pptx
SE2023 0401 Software Coding and Testing.pptxSE2023 0401 Software Coding and Testing.pptx
SE2023 0401 Software Coding and Testing.pptx
 
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systemsTMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
Software testing strategies
Software testing strategiesSoftware testing strategies
Software testing strategies
 
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTINGA WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
 
Chap07
Chap07Chap07
Chap07
 
11 whiteboxtesting
11 whiteboxtesting11 whiteboxtesting
11 whiteboxtesting
 
connecting discrete mathematics and software engineering
connecting discrete mathematics and software engineeringconnecting discrete mathematics and software engineering
connecting discrete mathematics and software engineering
 

Último

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 

Último (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 

Estimating Path Execution Frequency Statically Using Static Analysis

  • 1. Estimating Path Execution Frequency StaticallyRay Buse Wes Weimer THE ROAD NOT TAKENICSE 2009 Vancouver, BC
  • 2. 2 The Big Idea  Developers often have a expectations about common and uncommon cases in programs  The structure of code they write can sometimes reveal these expectations
  • 3. 3 Example public V function(K k , V v) { if ( v == null ) throw new Exception(); if ( c == x ) r(); i = k.h(); t[i] = new E(k, v); c++; return v; }
  • 4. 4 Example public V function(K k , V v) { if ( v == null ) throw new Exception(); if ( c == x ) restructure(); i = k.h(); t[i] = new E(k, v); c++; return v; } Exception Invocation that changes a lot of the object state Some computation
  • 5. 5 Path 1 public V function(K k , V v) { if ( v == null ) throw new Exception(); if ( c == x ) restructure(); i = k.h(); t[i] = new E(k, v); c++; return v; }
  • 6. 6 public V function(K k , V v) { if ( v == null ) throw new Exception(); if ( c == x ) restructure(); i = k.h(); t[i] = new E(k, v); c++; return v; } Path 2
  • 7. 7 Path 3 public V function(K k , V v) { if ( v == null ) throw new Exception(); if ( c == x ) restructure(); i = k.h(); t[i] = new E(k, v); c++; return v; }
  • 8. 8 HashTable: put public V put(K key , V value) { if ( value == null ) throw new Exception(); if ( count >= threshold ) rehash(); index = key.hashCode() % length; table[index] = new Entry(key, value); count++; return value; } *simplified from java.util.HashTable jdk6.0
  • 9. 9 Intuition How a path modifies program state may correlate with it’s runtime execution frequency  Paths that change a lot of state are rare  Exceptions, initialization code, recovery code etc  Common paths tend to change a small amount of state Stack State + Heap State
  • 10. 10 More Intuition  Number of branches  Number of method invocations  Length  Percentage of statements in a method executed  …
  • 11. 11 Hypothesis We can accurately predict the runtime frequency of program paths by analyzing their static surface features Goals:  Know what programs are likely to do without having to run them (Produce a static profile)  Understand the factors that are predictive of execution frequency
  • 12. 12 Our Path  Intuition  Candidates for static profiles  Our approach  a descriptive model of path frequency  Some Experimental Results
  • 13. 13 Applications for Static Profiles  Indicative (dynamic) profiles are often hard to get Profile information can improve many analyses  Profile guided optimization  Complexity/Runtime estimation  Anomaly detection  Significance of difference between program versions  Prioritizing output from other static analyses
  • 14. 14 Approach  Model path with a set of features that may correlate with runtime path frequency  Learn from programs for which we have indicative workloads  Predict which paths are most or least likely in other programs
  • 15. 15 Experimental Components  Path Frequency Counter  Input: Program, Input  Output: List of paths + frequency count for each  Descriptive Path Model  Classifier
  • 16. 16 Our Definition of Path  Statically enumerating full program paths doesn't scale  Choosing only intra-method paths doesn't give us enough information  Compromise: Acyclic Intra-Class Paths  Follow execution from public method entry point until return from class  Don’t follow back edges
  • 17. 17 Experimental Components  Path Frequency Counter  Input: Program, Input  Output: List of paths + frequency count for each  Descriptive Path Model  Input: Path  Output: Feature Vector describing the path  Classifier
  • 18. 18 Count Coverage Feature • pointer comparisons • new • this • all variables • assignments • dereferences • • fields • • fields written • • statements in invoked method • goto stmts • if stmts • local invocations • • local variables • non-local invocations • • parameters • return stmts • statements • throw stmts
  • 19. 19 Experimental Components  Path Frequency Counter  Input: Program, Input  Output: List of paths + frequency count for each  Descriptive Path Model  Input: Path  Output: Feature Vector describing the path  Classifier  Input: Feature Vector  Output: Frequency Estimate
  • 20. 20 Classifier: Logistic Regression  Learn a logistic function to estimate the runtime frequency of a path Likely to be taken Not likely to be taken Input path {x1, x2 … xn}
  • 21. 21 Model Evaluation  Use the model to rank all static paths in the program  Measure how much of total program runtime is spent:  On the top X paths for each method  On the top X% of all paths  Also, compare to static branch predictors  Cross validation on Spec JVM98 Benchmarks  When evaluating on one, train on the others
  • 22. 22 Evaluation: Top Paths Choose 5% of all paths and get 50% of runtime behavior Choose 1 path per method and get 94% of runtime behavior
  • 23. 23 Evaluation: Static Branch Predictor We are even a reasonable choice for static branch prediction Branch Taken; Forward Not Taken A set of heuristics Always choose the higher frequency path
  • 24. 24 Model Analysis: Feature Power Exceptions are predictive but rare Many features “tie” Path length matters most More assignment statements → lower frequency
  • 25. 25 Conclusion A formal model that statically predicts relative dynamic path execution frequencies A generic tool (built using that model) that takes only the program source code (or bytecode) as input and produces  for each method, an ordered list of paths through that method The promise of helping other program analyses and transformations
  • 27. 27 Evaluation by Benchmark 1.0 = perfect 0.67 = return all or return nothing