确定 C 代码的处理器缓存效率
我想确定给定的 C 代码如何有效地利用处理器缓存,如果可能的话,确定缓存中存在哪些数据以及主内存中存储哪些数据(尽管这更值得拥有) - 是否存在有没有软件可以做到这一点?
我知道这可能不适合堆栈溢出的范围,尽管它当然与编程高度相关,因为我打算将它用作测试我正在编写的代码的工具。如果有更合适的地方请告诉我/mods移动这个问题。
此外,我(非常)更喜欢该软件适用于 mac os x/unix。
谢谢!
I'd like to determine how efficiently given C code utilises processor cache, and if possible, determine what data is present in the cache and what is stored in main memory (though that is more of a nice-to-have) - is there software out there that can do this?
I know this may not fit into the remit of stack overflow, though of course it is highly related to programming as I intend to use it as a tool to test code I am writing. If there is a more appropriate place, please let me know/mods move this question.
Additionally, I'd (much) prefer the software to be for mac os x/unix.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有多种分析器可以根据缓存未命中捕获配置文件,作为基于定期时间间隔的采样的替代方案。这将使您了解程序中哪些地方没有有效地使用缓存。在 Mac OS X 上,请查看 Shark(免费 - CHUD 工具包的一部分)。在 Linux 上尝试 Zoom(商业版,但有 30 天免费评估许可证)。
There are various profilers which can capture profiles based on cache misses as an alternative to regular time interval based sampling. This will give you an idea as to where in your program you are not using cache effectively. On Mac OS X check out Shark (free - part of the CHUD tools package). On Linux try Zoom (commercial, but there's a free 30 day evaluation license).