News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Recent posts

#41
The Laboratory / Re: different compares clock c...
Last post by NoCforMe - February 11, 2025, 01:30:16 PM
Macros, schmacros.
The code given above by Villuy shows how simple this is:

  • Call QueryPerformanceCounter(), stash the start time
  • Run the operation you want to time
  • Call QueryPerformanceCounter() again, subtract the start time from this time
  • Scale the result using the value returned by QueryPerformanceFrequency(), display the result
#42
The Laboratory / Re: different compares clock c...
Last post by sinsi - February 11, 2025, 11:23:30 AM
Have a look at masm32\macros\timers.asm
You can count clock cycles and execution time with the macros.
They aren't in the MASM64 package though, but I think MichaelW ported them to 64-bit somewhere.
#43
The Laboratory / Re: different compares clock c...
Last post by zedd151 - February 11, 2025, 09:33:23 AM
Quote from: NoCforMe on February 11, 2025, 09:11:54 AMWhy should you have to write a program to find these timings when they're probably published somewhere already? It's not like they're some kind of Top Sekrit info.
Because timings can differ wildly from one processor to another, and definitely between AMD vs. Intel for some instructions. Same holds true for cycle counts as well, judging by some of the threads in this very board (The Laboratory).
#44
The Laboratory / Re: different compares clock c...
Last post by NoCforMe - February 11, 2025, 09:11:54 AM
Why should you have to write a program to find these timings when they're probably published somewhere already? It's not like they're some kind of Top Sekrit info.
#45
The Laboratory / Re: different compares clock c...
Last post by zedd151 - February 11, 2025, 09:02:33 AM
Quote from: NoCforMe on February 11, 2025, 08:53:52 AMI think the OP was asking for timings of these instructions, not code to measure them.
I think that was a hint for daydreamer to time them for himself. I think...  :cool:
I, of course, could be mistaken. That's happened once before.  :tongue:
#46
The Laboratory / Re: different compares clock c...
Last post by NoCforMe - February 11, 2025, 08:53:52 AM
I think the OP was asking for timings of these instructions, not code to measure them.
#47
The Laboratory / Re: different compares clock c...
Last post by Villuy - February 11, 2025, 07:12:12 AM
Count for each:

.486p
.model flat, stdcall
option casemap:none

include C:\masm32\include\kernel32.inc
includelib C:\masm32\lib\kernel32.lib

.data?

PerformanceFrequency dword ?
dword ?
PerformanceCount1 dword ?
dword ?
PerformanceCount2 dword ?
dword ?

TimeSpent dword ?

.code

Start:

invoke QueryPerformanceFrequency, offset PerformanceFrequency ; Ticks per second frequency
invoke QueryPerformanceCounter, offset PerformanceCount1 ; Execution start time
mov ecx, 1000000000

CountTime:

test eax, 5
loop CountTime

invoke QueryPerformanceCounter, offset PerformanceCount2 ; Execution end time
mov eax, PerformanceCount2
sub eax, PerformanceCount1 ; Number of ticks elapsed
mov edx, 1000000 ; Converting ticks to microseconds
mul edx
div PerformanceFrequency
mov TimeSpent, eax ; Execution time in microseconds

invoke ExitProcess, 0

end Start
#48
ObjAsm / Re: Watch directory for change...
Last post by Biterider - February 11, 2025, 06:50:26 AM
Hi
Today I tested the code for what I wrote it and found that the file server packs the data much more tightly than running the same code on my PC.
This shows a bug that I only noticed when the unpacking loop was needed.

Another fix was the shutdown sequence.
First, the exit event is signalled to cut the data feed from the watch thread, and when that thread exists, it gets signalled to trigger the exit of the process thread.
This sequence now works as intended.

First post updated.

Regards, Biterider
#49
The Orphanage / Chinese phone
Last post by TimoVJL - February 11, 2025, 06:12:32 AM
My additional OnePlus phone started to do some odd things, it try to install their drivers to OS and destroy USB stack.
Have any other users similar problems ?