英文:
None of my code appears in Golang memory profiler output
问题
我目前正在开发一个Go程序,该程序从数据库加载数据,进行一些计算,然后将结果保存到同一个数据库中。程序中有多个goroutine。
运行时间(5-6分钟)出奇地长。根据这篇文章的建议,我进行了CPU性能分析,结果发现70%以上的CPU时间都用于垃圾回收相关的代码运行。
现在,我尝试进行内存分析,但我的代码在结果中没有出现。这是我第一次对程序进行性能分析,我不知道如何进行程序的优化或者在哪里寻找问题。非常感谢任何帮助。
提前感谢!
英文:
I'm currently working on a Go program that loads data from a database, runs some calculations and then saves the results to the same database. There are multiple gorutines.
The runtime (5-6 minutes) was surprisingly long. Following this article I performed CPU profiling and it turns out that 70%+ of the CPU time is Garbage Collection related code running.
Now, I tried memory profiling but none of my my code appears in the results. This is my first time profiling a program - I don't know how to proceed with optimisation of the program or where to look for problems. I appreciate any help.
Thanks in advance!
1: https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs "Debugging performance issues in Go programs"
2: https://i.stack.imgur.com/WMhgs.png
答案1
得分: 0
根据Adrian在评论中指出的,"问题"可以通过按累积而不是平坦排序来简单解决,例如使用top10 -cum
。
英文:
As pointed in the comments by Adrian, the 'problem' is simply solved by sorting by cumulative instead of flat, for example using top10 -cum
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论