230 likes | 325 Vues
This project focuses on developing a software tool to analyze the dynamic memory usage of component-based systems using AspectC++. It includes problem analysis, approach, modeling, current status, and challenges. The tool aims to measure and validate memory usage in real-time. Utilizing aspect-oriented programming and profiling techniques, it provides insights into component behavior and resource allocation. The project utilizes automatic instrumentation to transform and analyze code, identifying patterns for effective data collection and analysis. Challenges include compiler issues and skips in data collection.
E N D
Run-time Component memory analysis Project members: Gati Michael Johan Muskens Merijn de Jong Michel Chaudron 26 Sept 2003
Content • Project Introduction • (goals, idea and assumptions) • Problem analysis • Why use AspectC++ Approach • Analysis of AspectC++ • Modeling • Problems with AspectC++ • Current status of the project
Project Introduction Assumptions Goals Main Idea • Flexible and extendible design • Reusable extensions (implementation) • Investigate the use of aspect orientation • Validate the results of the tool with Chat application Main goal is to build a software tool to measure dynamic memory use of component based system
Project context & scope Project Introduction Robocop component Functional model Resource estimation model Software Tool Resource Measurement Source code model Document model
GoalsMain Idea Project Introduction Assumptions AC++ Dynamic memory information C++ Component Code Other Measurement Tool
Project Introduction GoalsMain Idea Assumptions Domain Linux development environment (G++/Ac++ compiler) C/C++ Implementation language Component design and development Aspect oriented programming (AspectC++) Mysql++ ( C++API) Assumptions &Constraints • Software tool should handle any generic c/c++ component • Software tool should be implemented in C/C++ under Linux environment
Chat Application Know the design and dynamic behaviour of the system Techniques used – function library modification Existing debugging tools Most tools analyze memory use by functions, call stack, block sizes Problem analysisExisting analysis work
Problem analysisChat application Idea • Relied on the knowledge of the component code Automatic instrumentation?
Transform CPU Unparsed C++ Parser C++’ Transform memory Compile Info Program Run Problem analysisTechniques of automatic instrumentation • Traditional way Extendibility Build multiple transforms (CPU, Memory ) Reuse the parser
Problem analysisTechniques of automatic instrumentation What is Aspect Oriented Programming? Goal of AOP -> separation of concerns Weaver takes the required input and process it into new program Aspect 1 Aspect2 Extendibility C++’ C++ Weaver A A Easy to add new Aspect B C Reusability B C Easy to reuse the code
Problem AnalysisProblems of Instrumentation techniques • Traditional way –parsing C++is difficult. • Aspect approach-alreadyexistsweaver for C++ -> but It is a prototype
What Profiling Aspect Extensibility Yes Yes High level of Abstraction/ Reusability No Yes Linux Platform Yes Yes Time of preparation Not feasible Feasible Build C++ parser Time of preparation - Feasible Aspect code Instrumentation Difficult Simple mechanism Why use AspectC++ Approach OPTIONS
Analysis of AspectC++Four Main questions • How to identify the patterns to instrument? • Which code to add to which pattern? • How to collect the reported data? • How to analyze the reported data?
Analysis of AspectC++How to identify the patterns to instrument? • Join points !! It is a place in the component code where an aspect code can interfere(function, a class, an attribute..) • Examples-join points for memory analysis
Analysis of AspectC++Which code to add to which pattern? We are interested in getting the following information • Size(allocated memory block) • Address of allocation • Address of deallocation • Time spent from allocation to deallocation • The name of the objects and class names
Analysis of AspectC++Which code to add to which pattern? advice code: You can specify when the join point should be called or executed by writing an advice code. Syntax: advice call (“joint point”):after(){ A} advice call (“joint point”):before(){ A} advice call (“joint point”):around(){ A} Join points can be combined with logical operators (||),(&&), or (!=)
Analysis of AspectC++ Example • Measure the size allocated by malloc() Advice call ("void * malloc (...)") && args (size): around (size_t size) { printf ("Memory size%ld: \n", size); tjp->proceed (); printf ("Pointer allocated: %p\n", *tjp->result ()); } Note: tjp==JoinPoint
Model 1-Mapping the measured data to different aggregation level Analysis: How to analyze data Application Total components Components Total classes/ component Classes Total objects /class Objects Each object
C/C++ Input code Aspect code Ac++ weaving Other profiler C’/C’++ G. program g++ compiling C/C++Program Instrumentation Data Collection MYSQL server DB(3-tables) DB connector Data Retrieval tables graphs Analyzer Architecture What is not instrumented? Class names & object names Which data is collected? The 3 tables-> but thee are some problems of skipping rows Which analysis is displayed? Memory use over time
Problems of Aspect++ • Compiler problems • some files in the gcc 3.x header files cannot be parsed byac++ • But it works for g++ 2.9x- Take the headers from another machine and adapt the working environment for ac++ • Unable to instrument operators new & delete • Pre-processor • Use aspect to instruct where to put overloaded operators
Next plan • Implementation –> 1 Nov(25 Nov for improvement) • Technical problems- >5-Oct-2003 1. Get all data from program to database 2. Perform experiments on: ->Chat application with aspect code under g++2.9x ->Pre-processor • Extract tables from Db and make different analysis- 1 November • Writing report->20 -Jan-2004 • Modeling chapter ->architecture and design- 17-Oct-2003 • Implementation chapter -> 27 –Nov-2003 • Verification & validation->12-Dec-2003 • Management -> 20 Jan 2004