A question regarding RDTSC operation
Posted: Fri Oct 12, 2012 6:08 am
Hi all,
I have a question regarding the way the processor acts when a RDTSC is used. I would like to do some timing measurements using RDTSC when cache is enabled and vice versa but I want to find out the best way in order to make the interference that I will get from reading the TSC in these 2 cases pretty much the same in both.
That is, if cache is enabled, RDTSC will be fetched from cache and so its interference will be much less than when it's fetched from main memory in the measurements with cache disabled.
So, my question is:
When cache is disabled, does the processor fetch the RDTSC instruction from main memory or is this avoided because the RDTSC is hard-coded to the processor?
In other words, which one of the following is true when a RDTSC is executed (with cache disabled) ?:
1)
- Fetch RDTSC instruction from main memory
- Read TSC from CPU register
OR
2)
- No need to fetch, read directly from CPU regsiter
Thanks in advance for your help.
P.S. If you guys want to share a technique that can help me achieve what I am looking for, I would really appreciate it.
I have a question regarding the way the processor acts when a RDTSC is used. I would like to do some timing measurements using RDTSC when cache is enabled and vice versa but I want to find out the best way in order to make the interference that I will get from reading the TSC in these 2 cases pretty much the same in both.
That is, if cache is enabled, RDTSC will be fetched from cache and so its interference will be much less than when it's fetched from main memory in the measurements with cache disabled.
So, my question is:
When cache is disabled, does the processor fetch the RDTSC instruction from main memory or is this avoided because the RDTSC is hard-coded to the processor?
In other words, which one of the following is true when a RDTSC is executed (with cache disabled) ?:
1)
- Fetch RDTSC instruction from main memory
- Read TSC from CPU register
OR
2)
- No need to fetch, read directly from CPU regsiter
Thanks in advance for your help.
P.S. If you guys want to share a technique that can help me achieve what I am looking for, I would really appreciate it.