flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 11 Aug 2021, 08:19
Sure, the code looks about right, and will probably work fine.
But you won't get actual nano-second timing. Most systems have a much lower frequency counter that isn't anywhere near 1GHz. Each counter step is more than 1ns. I suggest you use the QueryPerformanceFrequency function and display result to see what frequency your system has. |
|||
![]() |
|
Roman 12 Aug 2021, 04:03
I get my Cpu ryzen 3500 frequency 10 000 000
I Wonder Why 10000000? Why such a perfect number. Why not 10603246? |
|||
![]() |
|
revolution 12 Aug 2021, 04:46
That sounds about right. 10MHz is quite normal for most systems. So the smallest possible resolution is 100ns.
I don't know the significance of 10603246, but you can equally ask why not <any random value>, and the answer is because that is what the system has for its timer. Somewhere on the mobo is a 10MHz clock signal feeding into a counter. |
|||
![]() |
|
Roman 12 Aug 2021, 05:41
This mean 10 000 000 not 100% speed my Cpu.
|
|||
![]() |
|
revolution 12 Aug 2021, 07:37
If you want the CPU clock then there is RDTSC.
|
|||
![]() |
|
Roman 14 Aug 2021, 05:50
Very funny.
I try two code and get the same time(almost 1 millisecond). Code: mov rcx,2_042_000_000 .i: dec rcx jnz .i Code: mov rcx,2_042_000_000 .i: inc eax ;!* mean do parallel inc r8 ;!* inc r9 ;!* inc edx ;!* inc ebx ;!* inc edi ;!* dec rcx ;!* jnz .i I read AMD doing 4 instructions on tact . Ryzen 3500 (Zen2). 4 Ghz But this code show 8 instruction on tact. I'm lost . If i write in code couple regs. Like as inc esi and inc r10 i get different time. |
|||
![]() |
|
revolution 14 Aug 2021, 06:00
How many cycles were used to execute the loop? Use RDTSC to get the cycle count.
If it takes 4 cycles per loop, then the second loop only needs to execute 2 IPC to get the same timing. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.