Posted by: Sue Loh
Question: How can I measure TLB misses on Windows CE? 
If you are running a MIPS or SH processor then CeLog will capture counts of TLB misses.  On each thread switch it'll record a "TLB miss" event which has the count of TLB misses that happened during the time since the last thread switch.  That's a lot less informative than you might be hoping for -- it won't tell you the exact times of the TLB misses, or what addresses they happened on.  You'd have to manually instrument the kernel's TLB miss handler to get that.  And Kernel Tracker doesn't really do a good job of displaying TLB misses.  You'd be better off running readlog.exe.  If you use the "-s -v" parameters to get a verbose summary, it will add up TLB misses per thread, for example:

0x0002E942  0x00013242  0x00013242  0:00:00.099.172  Active   shell.exe

        Time in process 0x00013242: 0:00:00.099.172  (100.0% of thread run-time)

                     Total TLB Misses:      500

                Total thread switches:       25

  min TLB misses in one thread switch:        2

  max TLB misses in one thread switch:       35

                    TLB Misses/switch:       20.00

                   Total run time, ms:       99

                        TLB Misses/ms:        5.05

On ARM and x86, the OS has no knowledge of TLB misses, because TLB misses are handled completely in hardware.  There is no software TLB miss handler that the OS could use to record the events.  The only possible way for you to find out about TLB misses on ARM/x86 is if the CPU has hardware performance counters you can use to measure them.  Performance counters vary from one manufacturer to another and from one CPU to another, so look in the reference manual from the CPU manufacturer.  If they are supported you'd end up having to write CPU-specific code to access them.