- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Look at the attached picture. Above the picture is the source code,below is the assembly code. In the source code, N is equal to 1<<30. I have the following questions.
1. The code fragment in the red box needs to execute 1<<30 times(0x40000000), why the number of retired instructions is equal to 4,302,000,000,far less than 1<<30.(the number of sample after value of CPU_CLK_UNHALTED.THREAD event and INST_RETIRED.ANY event are both 2000000)
2. What is the meaning of retired instructions number(2,000,000) of the second assembly code "inc %esi" ? From the assembly code, it is the same with the "inc %eax".
3. Is the clockticks*cpu frequency equal to the elapsed time of the code snippet?
Thank you for your reply. :)
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
It would rather be a rude approximation. Even if this code is executed in a single thread you can get inaccurate elapsed time with this formula because cpu frequency may be changed during execution. The result will also depend on how OS schedules the thread.
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
There are 4 instructions in the loop. 4 * 0x40000000 = 0x100000000 = 4,294,967,296 that is about 4,302,000,000.
A non-precise event may be attributed to another instruction, not the instruction which caused the overflow. That is why we see different numbers for these instructions. You can find more details here: Hardware Event Skid.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Denis Mochanov (Intel) wrote:There are 4 instructions in the loop. 4 * 0x40000000 = 0x100000000 = 4,294,967,296 that is about 4,302,000,000.
A non-precise event may be attributed to another instruction, not the instruction which caused the overflow. That is why we see different numbers for these instructions. You can find more details here: Hardware Event Skid.
Thank you for your reply. So Is the clockticks*cpu frequency equal to the elapsed time of the code snippet?
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
It would rather be a rude approximation. Even if this code is executed in a single thread you can get inaccurate elapsed time with this formula because cpu frequency may be changed during execution. The result will also depend on how OS schedules the thread.

- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable