QB4.5 CPU utilization in WINNT, WIN2000 etc 
Author Message
 QB4.5 CPU utilization in WINNT, WIN2000 etc

Whenever I run a program written in QB4.5 (even within the IDE) the task
manager shows almost 100% cpu utilization even (or especially??) when
the program is waiting for input. Two questions occur to me: 1) Is this
normal behavior; and 2) how do I get it to release the cpu when it is
idle?


Sun, 11 Dec 2005 05:06:00 GMT  
 QB4.5 CPU utilization in WINNT, WIN2000 etc

Quote:

>Whenever I run a program written in QB4.5 (even within the IDE) the task
>manager shows almost 100% cpu utilization even (or especially??) when
>the program is waiting for input. Two questions occur to me: 1) Is this
>normal behavior; and 2) how do I get it to release the cpu when it is
>idle?

1) Yes - all those programs QB4.5/Qbasic . . . sit on a keyboard loop.
2) Adjust the idle sensitivity in the DOS window

--
Arargh at [drop the 'http://www.' from ->] http://www.arargh.com
Basic Compiler Samples Page: http://www.arargh.com/basic/basic.html

To reply by email, change the domain name, and remove the garbage.



Sun, 11 Dec 2005 05:35:59 GMT  
 QB4.5 CPU utilization in WINNT, WIN2000 etc

Quote:

>Whenever I run a program written in QB4.5 (even within the IDE) the task
>manager shows almost 100% cpu utilization even (or especially??) when
>the program is waiting for input. Two questions occur to me: 1) Is this
>normal behavior;

Yes.  The problem is that the program is constantly looping to check the
keyboard buffer.

Quote:
>and 2) how do I get it to release the cpu when it is idle?

Try the following:

================================ Begin =================================
DEFINT A-Z

'$INCLUDE: 'qbx.bi'

DECLARE SUB DOSIdle ()

DECLARE FUNCTION Inkey% ()

DIM SHARED Regs AS RegType

'***********************************************************************
'* SUB DOSIdle
'*
'* PURPOSE
'*    Uses DOS ISR 2FH, Function 1680H to give up a time slice to OS/2
'*    or Windows.
'***********************************************************************
SUB DOSIdle
   DIM RegsX AS RegTypeX

   RegsX.ax = &H1680                         'MS-DOS Idle call
   InterruptX &H2F, RegsX, RegsX             'Call DOS
END SUB

'***********************************************************************
'* FUNCTION InKey%
'*
'* PURPOSE
'*    Works similarly to BASIC's INKEY$ function, except the value
'*    returned is an integer rather than a string, if the key pressed
'*    is an extended key the value will be returned negated, and this
'*    routine optionally waits until a key is pressed before it returns
'*    control to the calling routine (set NoWait% to zero).
'***********************************************************************
FUNCTION InKey% (NoWait%) STATIC
   DO
      K$ = INKEY$                            'Check for a key
      DOSIdle                                'Give up idle time
   LOOP UNTIL NoWait% OR LEN(K$)             'Wait for a key, unless
                                             '  NoWait% is TRUE
   SELECT CASE LEN(K$)                       'Was a key pressed?
      CASE 1: InKey% = ASC(K$)               'Return ASCII value
      CASE 2: InKey% = -ASC(RIGHT$(K$, 1))   'Extended key, return ASCII
   END SELECT                                '  value negated
END FUNCTION
================================= End ==================================

The  idea  is  that  you  simply  put  in  a call to SUB DOSIdle in your
keyboard polling loop.

------------------------------------------------------------------------
He that loseth wealth, loseth much; he that loseth friends, loseth more;
but he that loseth his spirit loseth all.

--Spanish Maxim
------------------------------------------------------------------------
Joe Negron from Bay Ridge, Brooklyn, NY, USA



Sun, 11 Dec 2005 09:43:26 GMT  
 QB4.5 CPU utilization in WINNT, WIN2000 etc

Quote:


>>Whenever I run a program written in QB4.5 (even within the IDE) the task
>>manager shows almost 100% cpu utilization even (or especially??) when
>>the program is waiting for input. Two questions occur to me: 1) Is this
>>normal behavior; and 2) how do I get it to release the cpu when it is
>>idle?

> 1) Yes - all those programs QB4.5/Qbasic . . . sit on a keyboard loop.
> 2) Adjust the idle sensitivity in the DOS window

I would move to powerbasic if you want to stay with Windows.  Or move to
Unix a Unix type OS..


Sun, 11 Dec 2005 11:22:01 GMT  
 QB4.5 CPU utilization in WINNT, WIN2000 etc

Quote:


> >Whenever I run a program written in QB4.5 (even within the IDE) the task
> >manager shows almost 100% cpu utilization even (or especially??) when
> >the program is waiting for input. Two questions occur to me: 1) Is this
> >normal behavior; and 2) how do I get it to release the cpu when it is
> >idle?
> 1) Yes - all those programs QB4.5/Qbasic . . . sit on a keyboard loop.
> 2) Adjust the idle sensitivity in the DOS window

> --
> Arargh at [drop the 'http://www.' from ->] http://www.arargh.com
> Basic Compiler Samples Page: http://www.arargh.com/basic/basic.html

> To reply by email, change the domain name, and remove the garbage.

I would gladly adjust the idle sensitivity, but I see no way to do it in
WIN2000. How is it done?


Sun, 11 Dec 2005 22:21:48 GMT  
 QB4.5 CPU utilization in WINNT, WIN2000 etc

Quote:



>> >Whenever I run a program written in QB4.5 (even within the IDE) the task
>> >manager shows almost 100% cpu utilization even (or especially??) when
>> >the program is waiting for input. Two questions occur to me: 1) Is this
>> >normal behavior; and 2) how do I get it to release the cpu when it is
>> >idle?
>> 1) Yes - all those programs QB4.5/Qbasic . . . sit on a keyboard loop.
>> 2) Adjust the idle sensitivity in the DOS window

>> --
>> Arargh at [drop the 'http://www.' from ->] http://www.arargh.com
>> Basic Compiler Samples Page: http://www.arargh.com/basic/basic.html

>> To reply by email, change the domain name, and remove the garbage.
>I would gladly adjust the idle sensitivity, but I see no way to do it in
>WIN2000. How is it done?

Create a shortcut to \winnt\system32\command.com
it's in the misc tab.

--
Arargh at [drop the 'http://www.' from ->] http://www.arargh.com
Basic Compiler Samples Page: http://www.arargh.com/basic/basic.html

To reply by email, change the domain name, and remove the garbage.



Sun, 11 Dec 2005 23:46:50 GMT  
 QB4.5 CPU utilization in WINNT, WIN2000 etc

Quote:




> >> >Whenever I run a program written in QB4.5 (even within the IDE) the task
> >> >manager shows almost 100% cpu utilization even (or especially??) when
> >> >the program is waiting for input. Two questions occur to me: 1) Is this
> >> >normal behavior; and 2) how do I get it to release the cpu when it is
> >> >idle?
> >> 1) Yes - all those programs QB4.5/Qbasic . . . sit on a keyboard loop.
> >> 2) Adjust the idle sensitivity in the DOS window

> >> --
> >> Arargh at [drop the 'http://www.' from ->] http://www.arargh.com
> >> Basic Compiler Samples Page: http://www.arargh.com/basic/basic.html

> >> To reply by email, change the domain name, and remove the garbage.
> >I would gladly adjust the idle sensitivity, but I see no way to do it in
> >WIN2000. How is it done?
> Create a shortcut to \winnt\system32\command.com
> it's in the misc tab.

> --
> Arargh at [drop the 'http://www.' from ->] http://www.arargh.com
> Basic Compiler Samples Page: http://www.arargh.com/basic/basic.html

> To reply by email, change the domain name, and remove the garbage.

It works for the compiled program. Thank you.
Is there any way to make it work for the IDE?
Can it be made to work for cmd rather than command?


Mon, 12 Dec 2005 02:15:44 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Access Causing High CPU Utilization

2. Checking CPU utilization from VB code

3. Checking on CPU Utilization

4. 100% CPU utilization in a VB6 application using MS Hierarchical FlexGrid

5. Pause Program Execution WITHOUT high CPU Utilization

6. 100% CPU Utilization

7. 100% CPU Utilization

8. Showing Form vbModal from sub causes 100% cpu utilization

9. Determine CPU Utilization

10. VB app at 98% CPU utilization

11. CPU Utilization

12. CPU Utilization

 

 
Powered by phpBB® Forum Software