Runtime Monitoring using Aspect Oriented Programming

Jump to: navigation, search

We are using AOP to create a high-level abstraction for creating efficient runtime monitoring instrumentation. This project entails extending AOP ideas and implementations to support more detailed advice weaving and advice weaving over non-code dimensions (e.g., for sampling). An AspectBench Compiler extension implementation that adds several new pointcut designators to AspectJ. These designators extend the detail of weaving available in AspectJ to support the breadth of runtime monitoring needs that exist.

To use the extension, please follow these basic steps

Save the following libraries aopmon.tar to your desired director. un-tar aopmon.tar. You should have three directories under aopmon directory named bbs_libs, linpack, and abc_bin_directory. bbs_libs contains the libraries needed to run your aspect. abc_bin_directory contains two script files to run abc. run (linux) and run.bat (windows). linpack is an example.

In your abc_bin_directory, edit run to point to the correct JAVA_HOME path JAVA_HOME=$WHERE_EVER_YOUR_JAVA_IS The linpack directory contains an example. It also has two scripts. The first is used to compile your program and aspect code. The second is used for executing the code. The two files are tailored for the linpack example. You should notice Helper.class file in the bbs_libs directory. This file contains helper functions used by several PCDs and should be always present in any example you write.

To know the usage of abc type abc -help The following is a list of the new PCDs supported by the extension

basicBlcok(): This PCD matches the execution of a basicblock. It is used with args() pointcut to get the ID of a basicblock within a method. An example is illustrated below pointcut p(int blockID): basicblock() && args(blockID); weaveprobability(P): This designator controls whether weaving at a statically matching joinpoint shadow occurs where 0<=p<=1. An example is illustrated below pointcut p(): weaveprobability(0.1) && execution(* *.*(..)) sliceof(N,M): This designator selects the Mth fraction of joinpoint shadows, of size (1/N)|JPSET| In other words, of the total number of shadows that match the pointcut expression, this selects 1/N of them, and the slice that it selects is the Mth one. An Example pointcut p(): sliceof(10,2) && execution(* *.*(..)) Note: you should compile the program twice to if you are using this PCD. The first compilation give the total number of JPs to be used in the second compilation. firstn(N): This will execute the advice at a joinpoint the first N times a joinpoint occurs from a given shadow, and after that will not execute on any more joinpoints from that shadow. pointcut p(): firstn(100) && execution(* *.*(..)) aftern(N): This designator executes the advice on joinpoints of a given shadow only after the first N joinpoints of a given shadow have already occurred. Thus, it skips the advice the first N times the shadow is reached, and afterwards it always executes the advice. pointcut p(): aftern(100) && execution(* *.*(..)) everynth(N): This designator executes the advice only every Nth joinpoint occurrence for a given shadow, beginning with the first joinpoint pointcut p(): everynth(5) && execution(* *.*(..))