Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memory Latency Program

Status
Not open for further replies.

pukiamak

Technical User
Jul 14, 2006
44
US
Hello Guys,

I am wondering if any of you guys have the example code for memory latency program in C? I am thinking to develop it in Linux using Gcc.

Thanks
 
What's a memory latency program supposed to do anyway?

Measure the performance of various kinds of 'memory' in the system? Which ones would you choose?
- Primary level cache
- Secondary level cache
- Main memory
- Swap memory

Or are you talking about getting the DRAM timing information from the BIOS?

You're not being very clear about what you want to achieve.


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
yes the program should be able to measure the elapsed time for the addresses in the primary level cache, secondary, main and so on.

the user will supply the address or it should have the default address to start from.

Thanks
 
You do know that all memory access goes through the primary level cache right?

What I think you're after is
- if primary level cache is a miss, how much longer does it take to get it from secondary cache.
- if the secondary level cache is also a miss, how much longer does it take to get it from main memory.
- if the page in main memory is currently swapped out, how much longer does it take to load a page from disk.

This is going to be pretty hard to do without detailed knowledge of your system. It's also going to require some assembler knowledge IMO, since C doesn't care about caches or swap space (they're all taken care of by the hardware and the OS).

You're also going to need a very accurate clock, because L1 to L2 isn't going to be much.

What are you hoping to gain from knowing this information?


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
even in assembler this is going to be horrid to do, because assembler doesn't care whether things are in the cache or not, either.

Michael Abrash wrote a lot about timing code, and fast performance code, back when the pentium was new. You could search for him and "Zen timer" for further information. But it's all a bit old now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top