net/http/pprof和runtime/pprof之间的区别是什么?

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

Difference between net/http/pprof and runtime/pprof

问题

我已经阅读了关于这里的分析资料,其中使用了net_http_pprofruntime_pprof进行解释。那么,这两者之间有什么区别,应该优先选择哪一个?请不要粘贴给定链接中的概述定义。

英文:

I have been reading about the profiling here it is explained using net_http_pprof and here runtime_pprof. So, what are difference between these two and which one should be prefer over another. And please don't paste the overview definition from the given links

答案1

得分: 7

net/http/pprof通过Web界面公开了pprof分析器的数据。如果你正在编写一个基于服务器的系统,这可能很有用,因为你可能无法访问主机。

runtime/pprof会将分析器数据写入一个数据文件,然后你可以将其转换为各种图像或文档类型。如果你正在编写一个不能或不会有Web界面的系统,那么这可能是你要使用的。无论哪种方式,它们都公开相同的数据。

英文:

net/http/pprof exposes the pprof profiler data via a web interface. If you're writing a server-based system, this may be useful since you may not have access to the host.

runtime/pprof will write the profiler data to a data file that you can then convert into various image or document types. If you're writing a system that can't or won't have a web interface, this is probably the one to use. Either way they expose the same data.

huangapple
  • 本文由 发表于 2016年3月1日 23:09:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/35726455.html
匿名

发表评论

匿名网友

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

确定