perfview
Speedscope.app is an online "flamegraph visualizer" that you can also install offline. It's open source and on GitHub. It will allow you to view flamegraphs that have been generated by diagnostic tools, but Speedscope is good at dealing with large files without issues or crashing. There's lots of choices in viewers of flamegraphs, but this is a good one.
Speedscope.app是一个在线“ flamegraph可视化工具”,您也可以离线安装。 它是开源的,并且在GitHub上。 它可以让您查看由诊断工具生成的火焰图,但是Speedscope擅长处理大型文件而不会出现问题或崩溃。 火焰图查看器中有很多选择,但这是一个不错的选择。
Adam Sitnik has a great blog about how he implemented flamegraphs for .NET.
亚当·锡特尼克(Adam Sitnik)拥有一个很棒的博客,介绍了他如何为.NET实现火焰图。
Speedscope has a simple file format in JSON, and PerfView already exists is free and open source. PerfView is something you should download now and throw in your PATH. You'll need it someday.
Speedscope具有JSON的简单文件格式,并且PerfView已经存在,是免费和开源的。 您应该立即下载PerfView并放入PATH中。 有一天你会需要它。
We saw in the last blog post that I did a GC Dump of my running podcast site, free command line tools. Now I'll do a live running trace with
我们在上一篇博客文章中看到,我对正在运行的播客网站进行了GC转储,使用了免费的命令行工具。 现在,我将与
网络跟踪(dotnet-trace)
So I'll just dotnet trace ps
and then
因此,我将通过dotnet trace ps
,然后
dotnet trace collect -p 18996
Which gives me this live running trace until I stop it:
这给了我这个实时运行的跟踪信息,直到我停止它:
Provider Name Keywords Level Enabled By
Microsoft-DotNETCore-SampleProfiler 0x0000000000000000 Informational(4) --profile
Microsoft-Windows-DotNETRuntime 0x00000014C14FCCBD Informational(4) --profile
Process : D:\github\hanselminutes-core\hanselminutes.core\bin\Debug\netcoreapp3.1\hanselminutes.core.exe
Output File : C:\Users\scott\trace.nettrace
[00:00:00:15] Recording trace 866.708 (KB)
Stopping the trace. This may take up to minutes depending on the application being traced.
Trace completed.
Even though this ran for just 15 seconds I collected many thousands of traces. If I need to, I can now find out EXACTLY what's happening in even short timeframes OR I can visualize what's happening over longer timeframes.
即使运行仅15秒钟,我仍收集了数千条痕迹。 如果需要,我现在可以准确地找出即使在很短的时间范围内正在发生的事情,也可以直观地看到在更长的时间范围内正在发生的事情。
Ah, but check out this switch for dotnet trace!
嗯,但是请检查此开关以进行dotnet跟踪!
--format <Chromium|NetTrace|Speedscope>
That's a useful game changer! Let's try a few, maybe Speedcope and that interestingly named Chromium format. ;)
这是一个有用的改变游戏规则的人! 让我们尝试一些,也许是Speedcope,以及有趣的Chromium格式。 ;)
NOTE: If you have any errors with Speedscope format, make sure to "
dotnet tool update -g dotnet-trace
"注意:如果使用Speedscope格式有任何错误,请确保“
dotnet tool update -g dotnet-trace
”
Now you'll get a something.speedscope.json that you can open and view in SpeedScope. You'll see a WEALTH of info. Remember that these formats aren't .NET specific. They aren't language specific at all. If you have a stack trace and can sample what's going on then you can make a trace that can be presented as a number of visualizations, most notably a flamegraph. This is 'how computers work' stuff, not '.NET stuff." It's great that these tools can interoperate so nicely.
现在,您将获得一个something.speedscope.json,可以在SpeedScope中打开并查看它。 您会看到大量的信息。 请记住,这些格式不是.NET特有的。 它们根本不是特定于语言的。 如果您有堆栈跟踪并且可以对正在发生的事情进行采样,则可以进行跟踪,该跟踪可以显示为多种可视化效果,最著名的是firegraph 。 这是“计算机如何工作”的东西,而不是“ .NET东西。”很好的是,这些工具可以很好地互操作。
There is so much info that you'll want to make you own with dotnet trace and explore. Be sure to scroll and CTRL-scroll to zoom around. Also be sure to look at the thread picker at the top center in the black title area of SpeedScope.
有太多信息,您希望通过dotnet跟踪和探索来拥有自己的位置。 确保滚动并按住CTRL滚动以放大。 另外,请务必查看SpeedScope黑色标题区域顶部中心的挑线器。
Remember how I pushed that this isn't language specific? Try going to edge://tracing/ in new Edge or in chrome://tracing in Chrome and load up a dotnet trace created with --format Chromium! Now you can use the Trace Event Profiling Tool!
还记得我是如何推动这不是特定于语言的吗? 尝试转到Chrome的新Edge中的edge:// tracing /或Chrome中的chrome:// tracing,并加载使用--format Chromium创建的dotnet跟踪! 现在您可以使用跟踪事件分析工具!
Same data, different perspective! But this time you're using the tracing format that Chromium uses to analyze your .NET Core traces! The dotnet-trace tool is very very powerful.
相同的数据,不同的观点! 但是这次,您使用的是Chromium用于分析.NET Core跟踪的跟踪格式! dotnet-trace工具非常强大。
Be sure to go read about Analysing .NET start-up time with Flamegraphs at Matt Warren's lovely blog.
一定要在Matt Matt Warren的可爱博客上阅读有关使用Flamegraphs分析.NET启动时间的信息。
perfview