views:

168

answers:

1

I'm starting the development of an OSGi bundle for an application that will be deployed in a device with some hardware limitations. I'd like to know how could I profile the execution of that bundle to be always sure that it's going to fit with its dependencies in the final device. It would be nice to have a profiler to know how much memory is each bundle using, to localize bottle necks and to compare different implementations of the same service.

Is there any profiler for OSGi deployments or should I use a general Java profiler?

For developing I'm using Pax runner with Apache felix to run the bundle and maven to manage project dependencies and building.

+1  A: 

My company develops OSGi applications for embedded devices. Unfortunately, I'm unaware of any tool that has all the capabilities that you are looking for. I can tell you what we do to deal with the kind of issues you are looking for.

1) Fitting on the device: We develop in Eclipse and deploy using Equinox. We build using .product files in Eclipse. By doing this, we get a firm idea of the amount of disk/ROM space that our program will take on the device.

2) For profiling, we generally use YourKit. There are other good Java profilers out there, but we've found that this one works well for us.

A good technique that you can do is to build a version of the services that acts as a proxy to the real service. The proxy is a great place to insert timing code, so that you can count how many calls are made to each service method and determine the time for each call. You can also categorize the timings based on the arguments this way to find badly performing edge cases. Then when you get ready to deploy, you can take out the proxies.

Good luck.

James Branigan
Thank you, a very interesting answer, I'll try your suggestions.
Jaime Soriano
YourKit is really useful, I can see memory usage and timing information with the CPU profiler.I have also found a nice post with some tips about OSGi profiling: http://www.osgilab.org/2010/03/osgi-tips-osgi-profiling-yourkit.html.Thanks!
Jaime Soriano