General > The Soap Box

Cache again....

(1/5) > >>

Raistlin:
Hiya,

Does anyone perhaps know how to interrogate the CPU cache (control registers or other perhaps) or OS scheduler to
reveal the specific cache hit vs miss ratios.....Sorry if this has been asked and answered before.

Thanks
Raistlin

hutch--:
I could be wrong but I don't think there is such an animal. I think you have to do this the hard way, design the code according to the best theory you have then put it to the only test that matters, how FAST it is.

Raistlin:
@Hutch, Agreed that would be the intent - however we know profiler applications exist that show cache miss/hit ratios for an application (RE: Intel, AMD, Microsoft)
therefore arguably you must be able to programatically read the cache hit vs miss data? Also we know there's API's to read for example process page faults. Thus my
investigation. Sorry if my logic is flawed and I'am blowing bubbles.

jj2007:

--- Quote from: Raistlin on September 05, 2017, 07:24:22 PM ---there's API's to read for example process page faults.
--- End quote ---

There is, there is:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  Init
  Inkey "PageFaultCount: 0x", Hex$(MemState(PageFaultCount))
EndOfCode

Output: PageFaultCount: 0x00000572 (note the process hasn't done anything useful so far...)

Google for PROCESS_MEMORY_COUNTERS. Or check this:

--- Quote ---Most recent CPUs (both AMD and Intel) have performance monitor registers that can be used for this kind of job. For Intel, they're covered in the programmer's reference manual, volume 3B, chapter 30. For AMD, it's in the BIOS and Kernel Developer's Guide.
--- End quote ---

Raistlin:
@JJ2007 - Thanks man !

OK.....

Seems my investigations should move to the Model Specific Registers - re: RDMSR and WRMSR - let me read and try to make sense of it

EDIT :-> Correction - this is EXACTLY what I was looking for <-

Applies to INTEL
--------------------
 
http://datasheets.chipdb.org/Intel/x86/Pentium/Embedded%20Pentium%AE%20Processor/MDELREGS.PDF



Applies to AMD
---------------------

https://support.amd.com/TechDocs/25481.pdf

Navigation

[0] Message Index

[#] Next page

Go to full version