View previous topic :: View next topic |
Author |
Message |
rogerh
Joined: 02 Nov 2014 Posts: 46 Location: Longmont, CO
|
Posted: Thu Apr 02, 2015 8:01 pm Post subject: help with sleep1@ |
|
|
Hi;
I'm trying to get my program to sleep without using CPU time.
Sleep1@ seems to be the answer but adding it to the program does nothing.
Do I have to invoke a library or something? The examples I've found just show the call.
TIA,
Roger |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Thu Apr 02, 2015 8:51 pm Post subject: |
|
|
Code: | use clrwin
do i=100,1,-1
CALL TEMPORARY_YIELD@
call sleep1@(0.5)
print*,' Ticking. At the count 0 you lose your harddrive ', i
enddo
end |
Last edited by DanRRight on Fri Apr 03, 2015 3:10 pm; edited 2 times in total |
|
Back to top |
|
|
rogerh
Joined: 02 Nov 2014 Posts: 46 Location: Longmont, CO
|
Posted: Thu Apr 02, 2015 9:17 pm Post subject: |
|
|
That seems to work but isn't it using CPU time between ticks?
I want it to sleep until called by another program.
Roger |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Thu Apr 02, 2015 10:18 pm Post subject: |
|
|
The call to temporary_yield@ might be useful if this were part of ClearWin+ code where it would allow the Windows message queue to be consumed.
sleep1@ with temporary_yield@ is the same as sleep@.
sleep1@ just calls the Microsoft function Sleep and this is simply a call to wait, allowing other apps to do their own thing.
I think that we need more information about what you want to do.
What action would trigger the application to wake up? |
|
Back to top |
|
|
rogerh
Joined: 02 Nov 2014 Posts: 46 Location: Longmont, CO
|
Posted: Thu Apr 02, 2015 10:38 pm Post subject: |
|
|
I'm not sure. It's a program I'm developing for someone else. He has a big Perl program and wants Fortran to speed things up.
I'm supposing that Perl will call this program as and when needed and he doesn't want Fortran to use up CPU time while waiting.
Roger |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Thu Apr 02, 2015 11:06 pm Post subject: |
|
|
One way would be to get the Perl program to spawn the Fortran program rather than have it waiting around.
If you really want both programs up and running then you could get the Perl program to create a file (containing data) when it wants the Fortran to do something. The Fortran would check if the data file exists on each tick etc..
There are many other possibilities. |
|
Back to top |
|
|
rogerh
Joined: 02 Nov 2014 Posts: 46 Location: Longmont, CO
|
Posted: Thu Apr 02, 2015 11:17 pm Post subject: |
|
|
Is there a source for more information?
The problem I'm having with F95 is the lack of examples.
I'm coming back to fortran after many years of TrueBasic. My first language was fortran IV and versions thereafter until I needed graphics, at which point I switched to TB
Now I need a fast modern language and F95 looks like it. I just wish it wasn't so expensive.
Roger |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Fri Apr 03, 2015 1:04 am Post subject: |
|
|
You have not made it clear why you need to call Sleep@ or similar routines.
If you are using a Fortran DLL to speed things up, the caller (Perl?) should defer making the call to the DLL until it has all the needed data to be sent to the Fortran routine. The DLL is then called and will do its assigned task as quickly as possible, and return control to the caller.
What is wrong with this description of what is needed? |
|
Back to top |
|
|
rogerh
Joined: 02 Nov 2014 Posts: 46 Location: Longmont, CO
|
Posted: Fri Apr 03, 2015 4:39 am Post subject: |
|
|
I can't say for sure at this time. I need to talk to the person I'm writing this for.
Roger |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Fri Apr 03, 2015 6:02 am Post subject: Re: |
|
|
PaulLaidler wrote: |
sleep1@ with temporary_yield@ is the same as sleep@.
|
My damn English...Not quite got what that means. What this program shows you in task manager CPU utilization respect to previous one?
Code: | use mswin
do i=1,100
call sleep@(0.5)
print*,' sucking'
enddo
end |
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Fri Apr 03, 2015 9:43 am Post subject: |
|
|
My apologies Dan. I should have checked the code for sleep@ rather than relying on my memory.
sleep@ does not call Sleep, it just repeatedly calls temporary_yield@. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Fri Apr 03, 2015 11:18 am Post subject: |
|
|
Welcome to my club, Paul, if you like me also forget your keys, phone, wallet and if you wear then possibly glasses
Last edited by DanRRight on Fri Apr 03, 2015 3:13 pm; edited 1 time in total |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Fri Apr 03, 2015 12:39 pm Post subject: |
|
|
Paul's suggestion to spawn a copy of the Fortran program when it is required is most sensible, but seems to have been lost in the middle of this thread. It would consume no cpu time and no RAM, and the loss would only be the time taken to load and initialise the program when it was spawned.
Communication between the previous 'incarnation' and the new one can be done with disk files, and subject the precise timings delays etc, the info might be still in the disk cache, and therefore speedily accessible.
Eddie |
|
Back to top |
|
|
rogerh
Joined: 02 Nov 2014 Posts: 46 Location: Longmont, CO
|
Posted: Sat Apr 04, 2015 3:02 pm Post subject: |
|
|
Thanks to all who responded.
My client is happy with SLEEP1@
Now he wants chart plotting so I'm off to explore that.
Roger |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Sat Apr 04, 2015 7:06 pm Post subject: |
|
|
That is easy and not that easy in the same time. In Clearwin+ you can do everything from ground zero with its powerful graphics libraries capable of plotting any thickness and color lines for curves and axis, any backgrounds, take any ourt of hundreds of modern fonts which exist in your computer (and all the utilities to know their height and length to place them ideally on the plotting board). This way you create your own completely controllable plotting utilities and can tune them up eventually to reach super quality and usability for decades since they will be always needed till your last days. And all that in Fortran and hence simple. 2D and 3D plots are also doable, also all in Fortran (and OpenGL). I have done all that. But that will take time initially, may be a month total or more depending on quality needed. But you will be happy. You will never happy with 3rd party software and it always die, so no one supports it. I used 3-4 of them, they disappeared or close to go to oblivion. All look primitive.
If you need your single plot with 1-3 curves in 3 minute then Simpleplot %pl is OK. Look at this forum's discussions on Simpleplot during last year. |
|
Back to top |
|
|
|