无论如何,有没有在OS X Mountain Lion上读取性能计数器的信息? [英] Is there anyway to read performance counters on OS X Mountain Lion?
问题描述
Shark是Apple的探查器,可用于配置自定义性能计数器,但由于它无法运行32位内核,因此在OSX Mountain Lion中不再受支持.苹果公司(Apple)替代鲨鱼(Shark)的Instruments.app似乎不支持读取性能计数器,例如L1缓存命中/未命中**.无论如何,有没有在OS X上实际设置和读取性能计数器的信息?即使没有应用程序,是否也有一些用户界面API可以做到这一点?
Shark, Apple's profiler which let you configure custom performance counters, is no longer supported in OSX Mountain Lion since it can't run a 32-bit kernel. Instruments.app, Apple's replacement for Shark, doesn't seem to support reading performance counters such as L1 cache hits/misses**. Is there anyway to actually setup and read performance counters on OS X? Even if there is no application, is there some user-land API to do this?
** Instruments.app似乎确实具有用于性能计数器的界面,但是在我的Retina MacBook Pro上,"PM事件"窗口未列出任何事件,并指示设备:未知".乐器还有其他选择吗?
**Instruments.app does seem to have an interface for performance counters, but on my Retina MacBook Pro, the PM Events window lists no events, and indicates "Device: Unknown." Are there any other alternatives to Instruments?
推荐答案
是的.在那里,但是很难找到并且使用起来很笨拙(版本4.5).
Yes. It's there, but difficult to find and clumsy to use (ver.4.5).
- 启动仪器.
- 向导向您致意
- 为OS X选择空白"模板
- 按
cmd
+L
显示库 - 将"Counters"工具添加到"Instruments"文档
- 按
cmd
+shf
+P
-将显示PM Events浮动窗口. - 让我们评估已执行的划分操作"-将已执行的划分操作"添加到"PM事件"窗口的搜索字段中.
- 现在将已执行划分操作"的状态"设置为可见"
- 现在返回主文档窗口,按
cmd
+I
以显示"Counters"工具的信息弹出窗口. - 按下
+
按钮 - 将新计数器的事件设置为划分执行的操作"
- 开始采样...
- 结束采样...
- Launch Instruments.
- You are greeted by the Wizard
- Choose "Blank" template for OS X
- Press
cmd
+L
to display the Library - Add "Counters" instrument to your Instruments document
- Press
cmd
+shf
+P
-- you are presented with the PM Events floating window. - Let's evaluate "Divide Operations executed" -- Add "Divide Operations executed" to the PM Events window's search field.
- Now set the "State" of "Divide Operations executed" to "Visible"
- Now back to the main document window, press
cmd
+I
to display the info popover of the "Counters" instrument. - Press the
+
button - Set the new Counter's event to "Divide Operations executed"
- Begin sampling...
- End sampling...
您将在Instruments的表列中看到结果.当然,您可以记录许多事件-因此,找到您感兴趣的L1缓存事件并添加它们而不是除法.
You will see the results in Instruments' table columns. Of course, there are many events you could record -- So find the L1 cache events you are interested in and add them instead of divides.
还应做好系统冻结的准备(在撰写本文时发生了一次).
这篇关于无论如何,有没有在OS X Mountain Lion上读取性能计数器的信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!