This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
using-jp2-to-instrument-programs-based-on-apache-felix [2011/03/05 17:07] yann |
using-jp2-to-instrument-programs-based-on-apache-felix [2011/03/05 17:09] yann |
||
---|---|---|---|
Line 17: | Line 17: | ||
====== Felix and SIP ====== | ====== Felix and SIP ====== | ||
- | While the previous code works well and allows instrumenting programs in most situations, we faced some difficulties when instrumenting SIP communications((http://sip-communicator.org/)). SIP Communicator is a Java VoIP and instant messaging client using Felix. Felix((http://felix.apache.org/site/index.html)) is the Apache implementation of the OSGi specifications, which defines a dynamic service deployment framework. The OSGi specifications((http://www.osgi.org/)) defines a framework on which service implementations or *bundles* are plugged and managed by the framework, independently of the underlying running JVM (and its classpath). The framework handles bundle discovery, dependencies, requests, and responses. Each bundle communicates only with/through the framework. | + | While the previous code works well and allows instrumenting programs in most situations, we faced some difficulties when instrumenting SIP communications((http://sip-communicator.org/)). SIP Communicator is a Java VoIP and instant messaging client using Felix. Felix((http://felix.apache.org/site/index.html)) is the Apache implementation of the OSGi specifications, which defines a dynamic service deployment framework. The OSGi specifications((http://www.osgi.org/)) defines a framework on which service implementations or //bundles// are plugged and managed by the framework, independently of the underlying running JVM (and its classpath). The framework handles bundle discovery, dependencies, requests, and responses. Each bundle communicates only with/through the framework. |
We wanted to count the numbers of executed bytecode instructions of SIP communicator using JP2. When instrumenting SIP Communicator, we ran into several problems, which we fixed as follows. | We wanted to count the numbers of executed bytecode instructions of SIP communicator using JP2. When instrumenting SIP Communicator, we ran into several problems, which we fixed as follows. | ||
Line 25: | Line 25: | ||
==== Not Instrumenting Felix ==== | ==== Not Instrumenting Felix ==== | ||
- | * Exclude Felix classes from instrumenting, so they can be executed without know JP2. We need to add <code>!className.startsWith("org/apache/felix")</code> to method <code>byte[] transform(ClassLoader loader, String className, Class<?> redefiningClass, ProtectionDomain domain, byte[] uninstrumentedBytes)</code> in <code> ch.usi.dag.jp2.agent.SimpleTransformer </code>. | + | Exclude Felix classes from being instrumented, so Felix can run without having to know about JP2. We added: |
+ | <code>!className.startsWith("org/apache/felix")</code> | ||
+ | to method: | ||
+ | <code>byte[] transform(ClassLoader loader, String className, Class<?> redefiningClass, ProtectionDomain domain, byte[] uninstrumentedBytes)</code> | ||
+ | in class: | ||
+ | <code> ch.usi.dag.jp2.agent.SimpleTransformer </code> | ||