英文:
IntelliJ Debugger: Count how many times a function is called
问题
我想要计算程序中某个函数被调用的总次数。该方法在不同的对象中被调用,我不想通过传递一个变量并让它们都累加到该变量上。
在 IntelliJ Debugger 中是否有一个功能可以统计函数被调用的总次数?
具体而言,我的程序是一个用于图问题的搜索树算法,我想要计算生成的搜索树有多少不同的分支。每个分支对应一次提到的函数调用。
英文:
I want to count how many times a function is called overall in my program. The method is called in different objects and I dont want to pass one variable through and let them all add to it.
Is there a feature in the IntelliJ Debugger that's counts how often a function is called overall?
Specificially, my program is a search-tree algorithm for a graph-problem and I want to count, how many different branches the generated search-tree has. Each of these branches corresponds to a call of the mentioned function.
答案1
得分: 3
- 设置一个断点
- 取消勾选暂停
- 勾选“断点命中”消息
- 运行代码后,搜索打印的消息并找到计数。
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论