1. How to find out how many times a given code segment is executed?
  2. How to stop execution only if the value of the variable is equal to something?
  3. How to stop execution only if someone throws an Exception, except for breakpoint on Exception.class?
  • @KutaBeach, should we guess the programming language (and OS) ourselves? - avp
  • corrected, but it seemed to me that everything should be standard everywhere, and if it depends on what it does on the development environment to some extent. - KutaBeach

1 answer 1

  1. The profiler to help, he will also tell you how long it takes. In theory, you can profile any code, unless of course it starts another program, since then you will have to process it as well. That seems like a nice java profiler .

  2. Let's say the point of the handwork is done manually in C ++.

    if (a == 1) { cin >> a; cout << "Точка остановки здесь." } 
  3. Put a breakpoint in a catch block or write e.printStackTrace () there

  • @igumnov, TS specified that he was interested in Java (not C ++) in IDE IntellijIdea. - avp
  • Thank you, the thing is, I can't change the code. And can you generally profile the execution of Maven tests? And another question: can I print the value of a variable somewhere while debugging? Question clarified, see PS. - KutaBeach
  • @avp Yes, while I was digging in the answer window, the thread changed. Now add something else. - igumnov
  • I still do not understand how you are trying to debug without changing the code? In any case, you will have to write there some code that displays the information you need at the moment, and not the one that the IDE offers. - igumnov
  • I can execute any expression through Watches in IntellijIdea. However, I do not understand how I save the results of the performance. - KutaBeach