SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Dernier

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 

Dernier (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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, ...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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...
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

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