PC Review


Reply
Thread Tools Rate Thread

constrain the no of sub procedure executions per second

 
 
Gum
Guest
Posts: n/a
 
      26th Sep 2008
I need to restrict the number of executions per second for two sub
procedures. When sum total of sub procedure executions per second is more
than a user defined number per second (e.g., five (5) per second), I need
the threads running the procedure to stop for a user defined period (e.g.,
one (1) second), while other processes can continue.
 
Reply With Quote
 
 
 
 
AndyM
Guest
Posts: n/a
 
      27th Sep 2008
If avgExec > userExec Then
waitTime = Now + TimeValue("00:00:05")
Do Until Now > waitTime
DoEvents
Loop
End If

DoEvents will pause execution and allow other processes to execute.

"Gum" wrote:

> I need to restrict the number of executions per second for two sub
> procedures. When sum total of sub procedure executions per second is more
> than a user defined number per second (e.g., five (5) per second), I need
> the threads running the procedure to stop for a user defined period (e.g.,
> one (1) second), while other processes can continue.

 
Reply With Quote
 
Gum
Guest
Posts: n/a
 
      27th Sep 2008
Thanks for your response. The avgExec variable, the number of executions per
sec, would be the total of the number of executions of two sub procedures per
second.

I need to find out how to get compute the 'avgExec' variable so that I can
use your procedure below to stop the execution when avgExec>userExec is true.

"AndyM" wrote:

> If avgExec > userExec Then
> waitTime = Now + TimeValue("00:00:05")
> Do Until Now > waitTime
> DoEvents
> Loop
> End If
>
> DoEvents will pause execution and allow other processes to execute.
>
> "Gum" wrote:
>
> > I need to restrict the number of executions per second for two sub
> > procedures. When sum total of sub procedure executions per second is more
> > than a user defined number per second (e.g., five (5) per second), I need
> > the threads running the procedure to stop for a user defined period (e.g.,
> > one (1) second), while other processes can continue.

 
Reply With Quote
 
Gum
Guest
Posts: n/a
 
      29th Sep 2008
Perhaps, I should explain further:

I have 2 sub procedures that are run concurrently:
Sub FirstSub()
if firstCondition=True then
....

wait 0.1 sec
secondSub
end if
end sub

sub SecondSub()
if secondcondition=True Then
....
wait 0.1 sec
FirstSub

end Sub
When the instances where condition1 and condition2 occur say 1 second apart
the program yields favourable results. However, if they run without
interruption, they would together take 0.2 secs to execute and this leads to
an error. I do not want to bypass the error as the condition is not
desirable. The Wait 0.1 sec time is just sufficient for each sub procedure
to compete its task before going to the other sub.





"Gum" wrote:

> Thanks for your response. The avgExec variable, the number of executions per
> sec, would be the total of the number of executions of two sub procedures per
> second.
>
> I need to find out how to get compute the 'avgExec' variable so that I can
> use your procedure below to stop the execution when avgExec>userExec is true.
>
> "AndyM" wrote:
>
> > If avgExec > userExec Then
> > waitTime = Now + TimeValue("00:00:05")
> > Do Until Now > waitTime
> > DoEvents
> > Loop
> > End If
> >
> > DoEvents will pause execution and allow other processes to execute.
> >
> > "Gum" wrote:
> >
> > > I need to restrict the number of executions per second for two sub
> > > procedures. When sum total of sub procedure executions per second is more
> > > than a user defined number per second (e.g., five (5) per second), I need
> > > the threads running the procedure to stop for a user defined period (e.g.,
> > > one (1) second), while other processes can continue.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Continual Executions wutzke Microsoft Excel Programming 2 22nd Mar 2008 01:28 PM
executions per second N+ Microsoft Excel Programming 2 6th Mar 2008 06:07 PM
Control file executions ipramod@gmail.com Microsoft C# .NET 2 13th Jul 2007 03:58 PM
Return Code From SQL Executions =?Utf-8?B?RWFybENQaGlsbGlwcw==?= Microsoft Access 1 21st Jul 2006 04:02 PM
Re: Avoid two simultaneous executions of the same app gani Microsoft Dot NET Framework 0 30th Sep 2003 02:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:46 AM.