CPU Usage 100%

From: Varun Singh (varun_at_nospam.net)
Date: 07/23/04


Date: Fri, 23 Jul 2004 19:24:15 +0530

Hi there,
              I am assuming this must be a common problem. I have an
application (Built in VC++ 6.0 on Win2K) which connects to a server and
downloads binary data which is parsed to draw images. The app contains a
Socket connection (Winsock 1.1, Async Handling of Connect, Close and Reads),
timers which refresh the backbuffer every 20 Milliseconds and blit the
buffer to the Window DC and an Idle Foreground Hook for my thread which does
some other calculation tasks. The parsing of the drawing data is handled
within the refresh timers too. It can end up taking some time depending on
the amount of data which comes down the socket.
     Now, the refresh timers are only initiated when the data has been
parsed, they are not continuously running. When I start the app, the CPU
usage hovers around 3% to 10% ... this is with all activity in full swing
(socket I/O, redraws, idle tasks, etc.) ... this climbs up to around 40% to
50% after about 5 minutes of running time. If the app is left running for
long, then the CPU usage for my app climbs up to 100% even if the socket is
closed and no refreshes are taking place. The Idle timers are not active
either. It stays that way until app shutdown. Why would this be happening
when I have no functionality occurring?
    When I profile the app, it seems my message handling procedure and it's
child functions take the most time as expected; the socket message handling
is done in an independent hidden window (maybe this is the issue? Two
windows and their message handlers?) ... where could the issue be? If I
haven't provided enough information, please let me know.

All input will be greatly appreciated.

Regards,
Varun



Relevant Pages

  • Re: Async Socket IO Question
    ... I think you're mostly bumping into Socket Timeout issues. ... If you kill the process of your client app, the TCP session isn't cleanly ... When your server sends to the client app, that send happens just fine (the ...
    (microsoft.public.dotnet.framework)
  • Re: Linux and OS wide events
    ... I am new to Linux programming. ... app that needs to dispatch events using C++. ... Registration requests will cause the socket the request appeared on to be added to the list of sockets messages of the requested kind will be "broadcasted" to. ...
    (comp.os.linux.development.apps)
  • CPU Usage 100%
    ... Socket connection, ... the refresh timers are only initiated when the data has been ... When I start the app, ... it seems my message handling procedure and it's ...
    (microsoft.public.win32.programmer.kernel)
  • CPU Usage 100%
    ... Socket connection, ... the refresh timers are only initiated when the data has been ... When I start the app, ... it seems my message handling procedure and it's ...
    (microsoft.public.win32.programmer.networks)
  • Re: CPU Usage 100%
    ... Just create a debug build of app, ... > the amount of data which comes down the socket. ... the refresh timers are only initiated when the data has been ... > is done in an independent hidden window (maybe this is the issue? ...
    (microsoft.public.win32.programmer.ui)