ewok
ewok

Reputation: 21453

Counting breakpoint hits

As this question is over 3 years old, I figured I'd bring it up again. Especially since the solution offered there isn't a real option for me.

I'm looking for a way to count passes over a particular breakpoint in the eclipse debugger without actually suspending the code. I need to do this because the issue I'm working on manifests itself only when thousands of messages are sent per second.

The solution offered above is not really feasible for me, as the code being debugged is in a remote location and I cannot really create the static class to track hits. Is there either a default feature or a plugin that will simply count breakpoint hits, or is it not possible in eclipse?

Upvotes: 4

Views: 1831

Answers (1)

Michał Grzejszczak
Michał Grzejszczak

Reputation: 2617

Actually in said question the only reason to use another class is to have a dedicated static variable that you can access from the breakpoint snippet. You can use any other static variable/method that is visble to the snippet.

For instance:

int a = System.getProperty("my-prop");
System.setProperty("my-prop", ++a);

That might be slow, so you could try with ThreadLocals or find youself a static var (or preferably a map to track many places) that you can hijack for this purpose.

Upvotes: 3

Related Questions