Lead time

Linux specific forum
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 151
Joined: Thu Dec 28, 2023 9:04 pm

Lead time

Post by rndrei »

How to find out the time of execution of a piece of code? You can read the current time and time after the event, but this is second () seconds. And I need to at milisecond!?
Axolotl
Enthusiast
Enthusiast
Posts: 798
Joined: Wed Dec 31, 2008 3:36 pm

Re: Lead time

Post by Axolotl »

Have you tried?

Code: Select all

ElapsedMilliseconds() 

Use it like this (with disabled Debugger):

Code: Select all

Global time = ElapsedMilliseconds()
; do some processing
time = ElapsedMilliseconds() - time
As a friendly reminder: Don't forget to use the Help Pages......
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PBJim
Enthusiast
Enthusiast
Posts: 294
Joined: Fri Jan 19, 2024 11:56 pm

Re: Lead time

Post by PBJim »

Axolotl wrote: Sun May 04, 2025 4:48 pm Use it like this (with disabled Debugger):

Code: Select all

Global time = ElapsedMilliseconds()
; do some processing
time = ElapsedMilliseconds() - time
Not quite, ElapsedMilliseconds() returns a quad variable type (.q) otherwise it will not work on 32-bit systems.

Code: Select all

Global time.q = ElapsedMilliseconds()
User avatar
Piero
Addict
Addict
Posts: 863
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Lead time

Post by Piero »

rndrei wrote: Sun May 04, 2025 4:18 pmmilisecond
Image

:wink:
Post Reply