Try Chronon Debugger with IntelliJ IDEA 13.1 EAP
Exciting news! The upcoming IntelliJ IDEA 13.1 will bring you integration with Chronon Debugger (via this plugin). You can try it right away with the latest preview build. In case you’re wondering, Chronon is a new revolutionary tool keeping track of running Java programs and recording their execution process for later analysis, which can be helpful when you need to thoroughly retrace your steps when dealing with complicated bugs.
Chronon is a commercial tool and normally you would need to buy a license to use it, but the awesome news for you is that it’s completely free to use with IntelliJ IDEA 13.1 Ultimate.
In this post I will give you a quick intro into how Chronon works and how you can use it with IntelliJ IDEA 13.1 EAP.
To enable Chronon, you need to go to Settings → Plugins → Install JetBrains plugin, select Chronon, and click Install plugin.
Chronon Include/Exclude Patterns
Chronon uses code instrumentation to record the data, so we need to tell it which classes it should look at. For that, open the run configuration that you’re using for your application and specify Include / Exclude Patterns on the Chronon tab. Choose the classes carefully, because tracking too many of them at the same time would have significant negative performance impact.
Let’s see how Chronon works on a simple example of the two-threaded array sorting, where one thread performs quicksort, and the other one does bubble sorting. It’s essential to understand that Chronon is not literally a debugger, as it only helps you record the execution progress and then, play it back, like a videotape.
Run with Chronon
Well, it’s time to run our app. For that we can either click the toolbar button or use the Run → Run ‘ChrononDemo’ with Chronon menu.
When the app finishes, IntelliJ IDEA unpacks the recording data and opens the Chronon tool window (which looks very similar that of Debugger.) Of course, you can open a previously recorded session and play it back via the Run → Open Chronon Recording action in the main menu.
Here we can step through the recorded data forward or backward by using the actions from the Run menu.
As the current position changes, the Locals tab displays values of local variables. If you select a local variable, the History tab displays the entire history of changes made to that variable during the recorded runtime. Note that the variables data is only shown for the primitives types and the classes specified in the Include Pattern.
Double-clicking a change in the History tab will take you to the code where it has occurred.
History of changes is available for elements of local arrays and collections as well.
Switch between threads
The Threads tab lets you switch between different threads that have been recorded.
One of the tabs in the Chronon tool window is the Method history. In it you can track the execution history of a method, with the input and output data, which makes it easy to see how and where a method has been invoked.
The Logging tab lets you define custom logging statements and track their output during the program execution.
Chronon is especially helpful when debugging failed tests. The Exceptions tab displays all recorded exceptions and you can double-click them to see a playback of how and when they occurred.
By the way, this is exactly what we’re doing to investigate problems that are otherwise very hard to reproduce when tests fail on our Teamcity build server. TeamCity uses Chronon to run tests so we can use its recordings at any time to examine problems and spot bugs.
Develop with Pleasure!
Subscribe to Blog updates
Thanks, we've got you!
Import Postman Collections to the HTTP Client
We know that many of you use Postman collections and want to stay in the flow while working with them. This means staying inside IntelliJ IDEA and not switching to a different app. Great news! You can now effortlessly transform Postman collections into .http and use them in the HTTP Client …
What’s New in IntelliJ IDEA 2023.1 for Spring Developers
The IntelliJ IDEA 2023.1 release came packed with updates for Spring. This blog post will highlight the most noticeable changes, including full support for Lombok, a reworked Spring tool window, navigation for Spring Security rules, Spring Security 6 support, and more. Remember that these featur…
‘Quick’ Features in IntelliJ IDEA
A few IntelliJ IDEA features or actions include the term ‘quick’. Do they speed up certain processes? Let’s find out. In this blog post, I’ll cover what these features are, why you need them, and how you can use them. 1. Quick Lists If you have actions that you use regularly but don’t have shortcut…
5 Best Features for Profiling Java Code In IntelliJ IDEA
When it comes to apps functioning efficiently, there is always room for improvement. Fast, lag-free, smooth operation – what else can a Java developer dream of? However, when you aim for this level of perfection in your app, you will need a comprehensive toolset to monitor performance and identif…