Mac OS的Perf统计信息等效吗?

问题描述 投票:1回答:1

Mac OS上是否有等同于perf stat的数据?我想对CLI命令做同样的事情,但谷歌搜索不会产生任何结果。

macos profiling performancecounter perf intel-pmu
1个回答
1
投票

[Mac OS X中有仪器工具,用于对包括硬件PMU在内的应用程序进行配置。默认是对CPU使用率进行采样分析器。一些文档:https://en.wikipedia.org/wiki/Instruments_(software)https://help.apple.com/instruments/mac/current/它还具有命令行变量:https://help.apple.com/instruments/mac/current/#/devb14ffaa5

打开终端,在/ Applications / Utilities中。

instruments -t "Allocations" -D ~/Desktop/YourTraceFileName.trace PathToYourApp

页面https://gist.github.com/loderunner/36724cc9ee8db66db305提及工具sample(“包含在标准Mac OS X安装中”)。

此外,对于较旧版本的Mac OS X(10.7之前的版本)和Xcode,提到了Shark工具:https://en.wikipedia.org/wiki/Apple_Developer_Tools#Shark

[使用Intel CPU,您可以尝试Intel Vtune探查器-https://software.intel.com/en-us/get-started-with-vtune-macos https://software.intel.com/en-us/vtune

其他更开放的intel工具(部分弃用了?)是https://github.com/opcm/pcm/,它具有某种OSX支持。文件:https://software.intel.com/en-us/articles/intel-performance-counter-monitor。需要自定义MacMSRDriver驱动程序(kext)。

perf stat确实对事件进行计数,但我不确定如何使用Instruments收集计数器。页面https://www.robertpieta.com/counters-in-instruments/显示了如何配置Instruments GUI进行事件计数:

要配置计数器,请从“仪器”导航菜单中选择“文件”->“记录选项”。就此帖子而言,将选择按时间抽样。使用+,您可以添加计数器可以计数的特定事件,这些事件在当前连接到仪器的特定CPU上可用。

因此,您至少可以指示仪器工具随时间定期记录计数器值。报告了该模式的一些问题:http://hmijailblog.blogspot.com/2015/09/using-intels-performance-counters-on-os.html

© www.soinside.com 2019 - 2024. All rights reserved.