perfspy


PerfSpy

PerfSpy is an open source for runtime logging, performance monitoring and code inspecting. It uses ApsectJ to weave around your application code at runtime, and logs the execution time of every method and its input parameters and values. It has a UI application, in which you can view the method invocations and their input and return values as trees. With it, you can spot performance bottlenecks and understand complex code flow.

Check this for tutorial: http://perfspy.blogspot.com/.

PerfSpy is mostly useful in an application where actions are performed through an interface -- if an application is written following "programming to interface, not implementations", then it should be the case. Using PerfSpy, you can write a simple Aspect to monitor the interface method, and in the configuration, you can specify which concrete method you'd like to monitor. For example, if your code uses Structs 1, you can write an aspect to monitor "org.apache.struts.action.Action.execute()", and in the configuration file, you can specify which of your application's concrete action class you'd like to monitor. By default, it logs method execution time. You can configure to log methods' input parameters and return values. By default, PerfSpy ships with 2 kinds of analyzing algorithms: analyzing if a method invocation takes too much time and analyzing how many times a method is invoked, through which, you can determine the performance bottleneck. And you can plug in your own code analysis algorithms.

The UI application presents the method invocations as a tree, and offers a lot of functions to easily manipulate the tree. Think of it as a code sequence diagram, except it is presented as a tree and allows you to collapse/expand/filter/search/highlight tree nodes. This is useful if you want to use PerfSpy to troubleshoot complex code flows.

This tool was inspired by my daily job of maintaining a huge legacy application. In some places, the complexity of this legacy application is hard to image and hard to get a grip on. This tool has help me probe deep into the legacy application and provide me with a lot of insights.

Project Information

The project was created on Feb 15, 2013.

Labels:
Java AspectJ open source runtime logging performance monitoring code inspecting method invocation tree