gpt4 book ai didi

macos - Mac OS 的 Perf stat 等价物?

转载 作者:行者123 更新时间:2023-12-04 04:14:17 28 4
gpt4 key购买 nike

Mac OS 上是否有等效的性能统计数据?我想为 CLI 命令做同样的事情,谷歌搜索没有产生任何结果。

最佳答案

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

Open Terminal, in /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

其他更开放的英特尔工具(部分弃用?)是 https://github.com/opcm/pcm/它有某种 OSX 支持。文档: https://software.intel.com/en-us/articles/intel-performance-counter-monitor .需要定制 MacMSRDriver驱动程序(kext)。
perf stat对事件进行计数,我不确定如何使用仪器收集计数器。页面 https://www.robertpieta.com/counters-in-instruments/显示如何配置 Instruments GUI 以进行事件计数:

To configure Counters, select File -> Recording Options from the Instruments navigation menu. For the purposes of this post, sampling by Time will be selected. Using the + you are able to add specific events that Counters can count available on the particular CPU currently connected to Instruments.



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

关于macos - Mac OS 的 Perf stat 等价物?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61069109/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com