260 likes | 433 Views
SIF: A Selective Instrumentation Framework for Mobile Apps. Shuai Hao , Ding Li, William G.J. Halfond Ramesh Govindan. Background. App Behaviors are Complex. Source: www.zdnet.com , 3/7/2013. , 2/9/2013. Source: www.zdnet.com , 6/6/2012. Motivation Design Implementation Evaluation.
E N D
SIF: A Selective Instrumentation Framework for Mobile Apps ShuaiHao, Ding Li, William G.J. Halfond Ramesh Govindan
Background App Behaviors are Complex Source: www.zdnet.com, 3/7/2013 , 2/9/2013 Source: www.zdnet.com, 6/6/2012
Motivation Design ImplementationEvaluation Motivation Many Studies on App Behavior AppInsight [OSDI’12] AppInsight [OSDI’12]
Motivation Design ImplementationEvaluation Motivation Many Studies on App Behavior FreeMarket [NDSS’12] FreeMarket [NDSS’12] AppInsight [OSDI’12]
Motivation Design ImplementationEvaluation Motivation Many Studies on App Behavior Dr. Android [SPSM’12] FreeMarket [NDSS’12] Dr. Android [SPSM’12] AppInsight [OSDI’12] All use app instrumentation
Motivation Design ImplementationEvaluation Motivation App Instrumentation Process is Complex FreeMarket Server 1 2 3 4 App Cloud Phone 6 5 Original In-App Billing Client App In-App Billing Instrumented API
Goal Instrumentation Framework for Mobile Apps It raises the level of abstraction for performing app instrumentation.
Approach Instrumentation Framework for Mobile Apps App Instrumentation Framework Instrumented App High-level Instrumentation Specification
Requirements Survey of Recent Research Instrument Modify app Binary? what? functionality? Task Find critical paths to debug slow apps AppInsight bytecode , method, path Study vulnerability of In - App Billing service FreeMarket bytecode Support fine - grained permissions Dr. Android bytecode AdCleaner Remove ads from app bytecode Location Auditor Trace apps’ access to both user location and Internet path R2: Instrument at different levels of granularity: bytecode, method, path R1: Instrument binary R3: Permit user-specified instrumentation
Requirements Survey of Recent Research R1: Instrument binary R2: Instrument at different levels of granularity: bytecode, method, path R3: Permit user-specified instrumentation
Challenges Finding the Right Abstractions How to succinctly specify code paths of interest? R2: Instrument at different levels of granularity: bytecode, method, path Involves ~150,000 path! How to find the high-level abstractions for what to instrument? Gmail
Challenges Providing Overhead Feedback 1 1 1 How to provide quick offline overhead feedback? 2 2 2 R3: Provide user-specified instrumentation GOOD Instr. Spec. BAD Instr. Spec. 3 3 3 4 4 4 5 5 5 Arbitrary user-level instrumentation can change execution time of instrumented app 6 6 6 CFG
Novel and flexible abstractions for specifying instrumentation points Support for user-specified instrumentation with quick overhead feedback Extensive evaluation that demonstrates expressivity and efficiency Contributions SIF: Selective Instrumentation Framework
Motivation Design ImplementationEvaluation SIF Workflow SIF Instrumenter App SIFScript Overhead Estimator Instrumented App High execution time Refine Overhead Feedback User
Motivation Design ImplementationEvaluation SIF Abstractions Survey of Recent Research Insert before/after Replace Track paths code point code point A B à Task AppInsight FreeMarket Dr. Android AdCleaner Location Auditor Set of dynamic traces between two user-specified codepoints Operations on set of instructions that share common attributes Codepoint Set Abstraction Path Set Abstraction
Motivation Design ImplementationEvaluation SIFScript AdCleaner Specify codepoint filter Instrumentation code Select target codepoints Hook with user defined code Place instrumentation User-specified instrumentation Before After
Motivation Design ImplementationEvaluation SIFScript A Location Auditor 1 1 1 1 1 1 1 2 2 2 2 2 2 D C 2 2 3 3 Find API invokes to GPS 3 3 4 4 4 3 3 4 B GPS GPS 4 4 5 5 Find API invokes to INTERNET Internet Internet Internet Internet 5 5 5 Place instrumen-tation 6
Motivation Design ImplementationEvaluation Realizing Path Set Abstraction A Reachability Analysis 1 • Find potential set of methods M • Invoke instructions • Class hierarchy 1 1 1 2 2 2 C D 2 4 5 3 3 3 4 4 3 4 B GPS 4 5 Internet Internet 4 5 5 5 6 M = {A, B, C, D}
Motivation Design ImplementationEvaluation Realizing Path Set Abstraction Path Profiling 1 1 1 • Ball-Larus approach • Extension to inter-procedural profiler Call Site 1 2 2 2 3 3 3 Runtime Statistics - Path 1: 3 times - Path 2: 5 times 4 4 5 5 Call Site 2 6 6 6 Control Flow Graph Path 1 Path 2 Unfolding path statistics P1,P2,P2,P1,P2,P2,P1,P2 P1,CS1,CS2,P2,CS1,… Record call-site info
Motivation Design ImplementationEvaluation Realizing Path Set Abstraction A A Path Stitching 1 1 1 1 1 1 1 1 Reproduce inter-procedural paths by simulated call stack analysis 2 2 2 2 2 2 D C D C 2 2 3 3 3 3 3 3 4 4 4 4 3 3 4 4 B B GPS GPS 4 4 5 5 Internet Internet Internet Internet 5 5 5 5 5 5 6 6 4 5 A: P2, CS2 C: P2, CS2 D: P1
Motivation Design ImplementationEvaluation Estimating Overhead Feedback • Overhead • Instructions inserted by SIF • User-specified instrumentation code 1 User Code 6 2 3 4 Introduced Overhead User Code 6 and instruction i in 5 CFG Dynamic execution statistics e.g. by workload generator Profiled estimates for instruction execution time
Motivation Design Implementation Evaluation Evaluation Overview Classical tasks: e.g. timing profiler Completeness Conciseness #Source lines of code Recent research: e.g. AppInsight , FreeMarket Instrumentation time Efficiency Runtime overhead Accuracy of overhead feedback
Motivation Design Implementation Evaluation Evaluation Conciseness of SIF SIF abstractions permit concise specifications
Motivation Design Implementation Evaluation Evaluation Efficiency of SIF: Runtime Overhead 0.8 4.4 0.6 1.3 1.0 0.4 SIF introduces <5% runtime overhead
Motivation Design Implementation Evaluation Evaluation Efficiency of SIF: Accuracy of Overhead Feedback SIF’s estimation error is within 7%
Conclusion SIF: A Selective Instrumentation Framework • Abstractions for specifying instrumentation points • Support for user-specified instrumentation with quick overhead feedback • Extensive evaluations that demonstrates expressivity and efficiency Future Work • Port SIF to other platforms • Use SIF to study various kinds of app behaviors • Extend overhead estimator to support more sophisticated instrumentation