如何分析一堆个人资料?

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

How do I analyze a bunch of profiles

问题

我有一堆关于我的应用程序的配置文件(每周200多个配置文件),我想要分析它们以获取一些性能信息。

我不知道可以从这些文件中分析出什么信息,也许是不同发布版本中最慢的函数或热点代码?

我在这个领域没有相关经验,有人有过这样的经历吗?

英文:

I have a bunch of profiles about my application(200+ profiles per week), I want to analyze them for getting some performance information.

I don't know what information can be analyzed from these files, maybe
the slowest function or the hot-spot code in the different release versions?

I have no relevant experience in this field, has anyone had that?

答案1

得分: 2

好的,以下是翻译好的内容:

嗯,这取决于你拥有的配置文件类型,你可以捕获多种不同类型的配置文件。

一般来说,大多数人对CPU配置文件和堆配置文件感兴趣,因为它们可以让你看到哪些函数/行使用了最多的CPU和分配了最多的内存。

你可以通过多种方式来可视化数据和/或深入研究它们。你应该查看一下go tool pprof的帮助输出和pprof博客文章,以帮助你入门。

至于配置文件的数量。一般来说,人们只会逐个分析它们。如果你想对多个样本进行平均,你可以使用pprof-merge合并多个样本。

你可以从一个配置文件中减去另一个配置文件,以查看相对变化。通过使用-diff_base-base标志。

另一种方法是提取每个配置文件中每个函数的百分比,并查看它们随时间的变化。你可以通过解析go tool pprof -top {profile}的输出来实现这一点。你可以将这些数据与已知事件(如软件更新或高需求)进行关联,并查看一个函数是否开始占用比其他函数更多的资源(它可能不会很好地扩展)。

如果你到达了开发自定义分析工具的阶段,你可以使用pprof库来解析配置文件。

英文:

Well, it depends on the kind of profiles you have, you can capture number of different kinds of profiles.

In general most people are interested in the CPU profile and heap profile since they allow you to see which functions/lines use the most amount of CPU and allocate the most memory.

There are a number of ways you can visualize the data and/or drill into them. You should take a look at help output of go tool pprof and the pprof blog article to get you going.

As for the amount of profiles. In general, people analyze them just one by one. If you want an average over multiple samples, you can merge multiple samples with pprof-merge.

You can substract one profile from another to see relative changes. By using the -diff_base and -base flags.

Yet another approach can be to extract percentages per function for each profile and see if they change over time. You can do this by parsing the output of go tool pprof -top {profile}. You can correlate this data with known events like software updates or high demand and see if one functions starts taking up more resources than others(it might not scale very well).

If you are ever that the point where you want to develop custom tools for analysis, you can use the pprof library to parse the profiles for you.

huangapple
  • 本文由 发表于 2022年1月15日 23:22:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/70722767.html
匿名

发表评论

匿名网友

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

确定