我的代码在 Golang 内存分析器输出中没有出现。

huangapple go评论151阅读模式
英文:

None of my code appears in Golang memory profiler output

问题

我目前正在开发一个Go程序,该程序从数据库加载数据,进行一些计算,然后将结果保存到同一个数据库中。程序中有多个goroutine。

运行时间(5-6分钟)出奇地长。根据这篇文章的建议,我进行了CPU性能分析,结果发现70%以上的CPU时间都用于垃圾回收相关的代码运行。

现在,我尝试进行内存分析,但我的代码在结果中没有出现。这是我第一次对程序进行性能分析,我不知道如何进行程序的优化或者在哪里寻找问题。非常感谢任何帮助。

我的代码在 Golang 内存分析器输出中没有出现。

提前感谢!

英文:

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.

我的代码在 Golang 内存分析器输出中没有出现。

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

huangapple
  • 本文由 发表于 2017年6月28日 23:38:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/44807030.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定