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 The Road Not Taken: Estimating Path Execution Frequency Statically

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 The Road Not Taken: Estimating Path Execution Frequency Statically (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

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Último (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

The Road Not Taken: Estimating Path Execution Frequency Statically

  • 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