flat assembler
Message board for the users of flat assembler.

flat assembler > Examples and Tutorials > Simple Win32 timer DLL

Author
Thread Post new topic Reply to topic
fasmnewbie



Joined: 01 Mar 2011
Posts: 523
Have lots of spare time today, so here goes nothing ;D

Attached is a simple timer DLL for Win32 meant to be accessed from C or probably C++. Actually I stole the code from BASELIB's "bkernel.asm" source. These two routines use QueryPerformanceCounter. You can use them without any time.h hassle in your source. Example

Code:
//
// Demo using timer functions from timer32.dll
// gcc -m32 this.c timer32.dll -o this.exe
//
#include <stdio.h>

extern int* timer_on();         //from timer32.dll
extern void timer_off(int *);   //from timer32.dll      

int main()
{
        double x = 45.3345;
        int *p = NULL;

        p = timer_on();
        
        //timed loop
        for (int y=1000; y > 0; y--) 
            printf("%.4f",x);

        timer_off(p);

        return (0);
}    


Should print the output of the timed code and the output of timer in seconds. I would probably make the linux and 64-bit versions if time permits.

Source code, the DLL and C test code are attached. Happy working, peeps! ;D


Description:
Download
Filename: timer32.zip
Filesize: 4.3 KB
Downloaded: 98 Time(s)

Post 25 Jan 2018, 04:04
View user's profile Send private message Visit poster's website Reply with quote
yeohhs



Joined: 19 Jan 2004
Posts: 170
Location: N 5.43564° E 100.3091°
Thanks for sharing. Very Happy Happy playing!

_________________
“It’s not that we have a short time to live, but that we waste a lot of it.”
-Lucius Annaeus Seneca
Post 26 Jan 2018, 00:45
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.