如何测试主存访问时间? [英] How to test main memory access time?

查看:80
本文介绍了如何测试主存访问时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在寻找一个C/C ++程序来测试访问固定内存(特别是在RAM中)所花费的时间.

如何确保测试访问时间不是缓存或TLB数据?

例如,我可以禁用"所有缓存/TLB吗?

还是可以在RAM中指定一个特定的地址以进行只读/只读操作?

另一方面,如何确保仅测试缓存?

有没有办法告诉编译器在哪里保存和读取缓存/内存?

例如,是否有一个众所周知的标准程序(在其中一本书中?))?

我确实看到了这一点,但是我不明白如何调整列表的大小,您可以控制内存访问是命中L1高速缓存,L2高速缓存还是主内存:解决方案

基本上,随着列表的增加,随着另一层缓存的不堪重负,性能会逐步下降.这个想法很简单...如果缓存保存了您访问过的最后N个内存单元,那么即使是N + 1个单元的缓冲区循环也应确保恒定的缓存未命中率. (在您的问题中链接到测量内存的延迟"中有更多详细信息/建议).

您应该能够从硬件文档中了解可能位于RAM前面的最大高速缓存的潜在大小-只要您使用的内存大于测量物理RAM时间的内存即可.

Looking for a C/C++ program to test how long it takes to access a fixed piece of memory, specifically in RAM.

How do I ensure testing access time is not of cache or TLB data?

For example, can I "disable" all cache/TLB?

Or can I specify a specific address in RAM to write/read only?

On the other hand, how would I ensure I am only testing cache?

Are there ways to tell the compiler where to save and read from, cache/ram?

For example, is there a well know standard program (in one of these books?) that is know for this test?

I did see this but I do not understand how adjusting the size of the list, you can control whether the memory accesses hit L1 cache, L2 cache, or main memory: measuring latencies of memory

How can one correctly program this test?

解决方案

Basically, as the list grows you'll see the performance worsen in steps as another layer of caching is overwhelmed. The idea is simple... if the cache holds the last N units of memory you've accessed, then looping around a buffer of even N+1 units should ensure constant cache misses. (There're more details/caveats in the "measuring latencies of memory" answer you link to in your question).

You should be able to get some idea of the potential size of the the largest cache that might front your RAM from hardware documentation - as long as you operate on more memory than that you should be measuring physical RAM times.

这篇关于如何测试主存访问时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆