Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » TIme and Idle
TIme and Idle [message #31401] Tue, 01 March 2011 10:04 Go to next message
Wlad is currently offline  Wlad
Messages: 20
Registered: February 2010
Location: Ukraine, KharkOv
Promising Member

1. How can I find the time to within one millisecond precision?
2. Is it an "OnIdle" event in U++?
Re: TIme and Idle [message #31407 is a reply to message #31401] Tue, 01 March 2011 10:42 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Wlad,

Wlad wrote on Tue, 01 March 2011 10:04

1. How can I find the time to within one millisecond precision?

If I remember correctly, there is GetTicks() function returning the number of miliseconds, which can be used to do this. Most of the time however, such precision is only useful for measuring purposes. If that is your case, have a look at TimeStop class, which provides easy way to measure time intervals with the precision you requested.
Wlad wrote on Tue, 01 March 2011 10:04

2. Is it an "OnIdle" event in U++?

AFAIK there is no such thing in U++ (but I might be wrong Smile ). It might be possible to "emulate" it using callbacks... Could you describe a bit what do you need it for? In most cases it can be just done in some other way Smile

Best regards,
Honza
Re: TIme and Idle [message #31410 is a reply to message #31407] Tue, 01 March 2011 11:15 Go to previous messageGo to next message
Wlad is currently offline  Wlad
Messages: 20
Registered: February 2010
Location: Ukraine, KharkOv
Promising Member

Hi, Honza,
dolik.rce wrote on Tue, 01 March 2011 11:42


Wlad wrote on Tue, 01 March 2011 10:04

1. How can I find the time to within one millisecond precision?

If I remember correctly, there is GetTicks() function returning the number of miliseconds, which can be used to do this. Most of the time however, such precision is only useful for measuring purposes. If that is your case, have a look at TimeStop class, which provides easy way to measure time intervals with the precision you requested.

TNX!

dolik.rce wrote on Tue, 01 March 2011 11:42

Wlad wrote on Tue, 01 March 2011 10:04

2. Is it an "OnIdle" event in U++?
AFAIK there is no such thing in U++ (but I might be wrong Smile ). It might be possible to "emulate" it using callbacks... Could you describe a bit what do you need it for? In most cases it can be just done in some other way Smile

I'll try to explain the roots of the problem.
They are stemmed from VERY large old application developed by an other guy.
It was developed at early 90s and DID NOT use multithreading.
You know... Smile MANY tasks processed in loop, every new sequence of which was initiated by receiving ON_IDLE mrssage...
Now I transform it into U++ «one-to-one» (using analogies).
While it works as «direct copy», I will try to rewrite it using multithreading approach.
Re: TIme and Idle [message #31419 is a reply to message #31410] Tue, 01 March 2011 13:18 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Wlad wrote on Tue, 01 March 2011 11:15

I'll try to explain the roots of the problem.
They are stemmed from VERY large old application developed by an other guy.
It was developed at early 90s and DID NOT use multithreading.
You know... Smile MANY tasks processed in loop, every new sequence of which was initiated by receiving ON_IDLE mrssage...
Now I transform it into U++ «one-to-one» (using analogies).
While it works as «direct copy», I will try to rewrite it using multithreading approach.

OK, I understand Smile Simple solution could probably be to use Cowork. Instead of waiting for "OnIdle", you would just post a callback to Cowork which should take care about the threading and scheduling at the same time. It maintains fixed size thread pool, so if you post more jobs than you have available threads, it will be queued and start when something else finishes, which is essentialy the same as idle state. Note that I never did something like this, so take it just as a guess Wink You'll find out if it works only if you try it Smile

Honza

[Updated on: Tue, 01 March 2011 13:18]

Report message to a moderator

Previous Topic: Background of static frames
Next Topic: Writing Float big-endian on Windows
Goto Forum:
  


Current Time: Mon Apr 29 06:39:25 CEST 2024

Total time taken to generate the page: 0.03683 seconds