No announcement yet.

Inkey$ - hogging CPU in win XP

  • Filter
  • Time
  • Show
Clear All
new posts

  • Marco Pontello
    Originally posted by A.Basit A.Bulbulia:
    Also another observation :- If a p4 CPU is used it will hog up 50% only while a Celeron CPU would be hogge'd to 100%.
    Probably with that P4 CPU you see the effect of HyperThreading (2 logical cores presented to the OS).


    Try Online TrID file identifier! Recognize over 1.700 filetypes and counting...
    Give a powerfull scriptable Lua interface to your application with PowerBLua
    PBTracer - Tracer / Profiler for PowerBASIC (soon!)

    Leave a comment:

  • Matthias Hoffmann
    This is a SUB whis is part of one of my old input-output-libraries.
    It was called during the keyboard-/mouse-polling-loop and contains some INTs
    which are recommend then. But I never did intensive testing to proof those
    calls to be helpfull in minimizing CPU load...

    SUB wRelease() LOCAL PUBLIC
       CALL INTERRUPT &H28 ' INT 28 destroys registers, so use CALL
       ! MOV AX,&h1680
       ! INT &h2F
       IF BIT(PBVHOST,8) = 0 THEN ' only without Win 3.1+
          ! MOV AX,&h8400
          ! INT &h2A
       END IF
    I think there are some more INTs to release time slice and/or support multi-
    tasking environments, take a look at Ralph Brown's Interrupt List.


    Leave a comment:

  • Mike Doty
    teratech had code to release a timeslice, but never used
    with pb. the routine was called idle and worked with qb.
    here is an example in pb/cc (which doesn't need it.)
    not sure if pb has a routine to release a timeslice.
    #compile exe
    #dim all
    declare function ink as string
    declare sub idle
    function pbmain  as long
      local keypress as string
      keypress = ink$
    end function
    function ink as string
      call idle
      ink = inkey$
    end function
    sub idle
      'release time slice code
    end sub
    this might be useful. see lance's code.

    [this message has been edited by mike doty (edited august 25, 2005).]

    Leave a comment:

  • Shawn Anderson

    this is not a PB problem, it is a Windows problem.
    win98 doesn't have the issue, but Win2k and later does.

    this is the best solution that I've found, and explains what
    is happening:

    If you go flying back through time and you see somebody else flying forward into the future, it's probably best to avoid eye contact.

    Leave a comment:

  • A.Basit A.Bulbulia
    started a topic Inkey$ - hogging CPU in win XP

    Inkey$ - hogging CPU in win XP

    Hi All !

    I was looking at this old thread and wondered if a better solution existed which did not hog the CPU when the inkey$/timer etc was used. I somehow cant seem to be able to post directly to the thread.

    Also another observation :- If a p4 CPU is used it will hog up 50% only while a Celeron CPU would be hogge'd to 100%. Why may this be?

    One other question :- The solutions provided assumes that Windows XP(NT) is used, has anyone noticed CPU hogging with Win98.

    Has PowerBasic released a fix etc ?