Mac OS X 上的高性能代码
我想知道在 OS X 上分析应用程序代码的最佳方法。我有一个纳秒分辨率计时器,经过一些基线测试后,我似乎遇到了大约 45 微的内核系统调用上下文切换(macbook 2ghz core2 duo 模型) )。
我注意到,如果我时不时地让我的应用程序循环一次,我可以获得大约 25,000-50,000 微的调度上下文切换。我正在测试一些算法,我想限制其影响。
我真正想要的是能够设置任务的处理器关联性,并将主线程优先级设置为实时,这并不是一件坏事,因为有一天这台 Macbook 可能会用作某些东西的低延迟控制器。关于如何在雪豹/XCode 上执行此操作有什么想法吗?
I would like to know the best way to profile app code on OS X. I have a nano-second resolution timer and it seems after some baseline testing that I am hitting a kernel syscall context switch of about 45 micro (macbook 2ghz core2 duo model).
I've noticed that if I let my app cycle every now and then I can get a scheduling context switch of about 25,000-50,000 micro. I am testing some algorithms, and I want to limit the effects of this.
What I really want is to be able to set the processor affinity of a task and also to set the main thread priority to realtime, which is not a bad thing because one day this Macbook may be used as a low-latency controller for something. Any ideas on how to do this on snow leopard / XCode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 Xcode 中使用 Shark。还有 DTrace。
You can use Shark in Xcode. There's also DTrace.