Re: 99% CPU usage in CWinThread::PumpMessage
From: Olaf van der Spek (Olaf_at_XCC.TMFWeb.NL)
Date: 04/12/04
- Next message: Olaf van der Spek: "Re: 99% CPU usage in CWinThread::PumpMessage"
- Previous message: Daniel James: "Re: C++ Standard Library"
- In reply to: KS: "Re: 99% CPU usage in CWinThread::PumpMessage"
- Next in thread: KS: "Re: 99% CPU usage in CWinThread::PumpMessage"
- Reply: KS: "Re: 99% CPU usage in CWinThread::PumpMessage"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 12 Apr 2004 17:48:42 +0200
KS wrote:
> Not sure without seeing the code.
If I understand the profiler output correctly, the following lines tell
me that the PumpMessage function consumed 98.6% of the time itself and
99.1% of the time was consumed by itself and it's children.
>> 75351,273 98,6 75773,696 99,1 1437
>>CWinThread::PumpMessage(void) (mfc42d.dll)
> But if you have a thread that has a loop in it, I'd suggest putting a
> Sleep(100) inside the loop. I've had problems with threads hogging up
> resources.
I do have a loop, but it's blocking on a select call.
>
> Another possibility is to lower the thread's priority.
That won't solve the CPU usage itself, although it's a reasonable
temporary workaround.
>
> KS
>
> "Olaf van der Spek" <Olaf@XCC.TMFWeb.NL> wrote in message
> news:u6f7utJIEHA.3444@TK2MSFTNGP11.phx.gbl...
>
>>Hi,
>>
>>I'm writing a file transfer application and I'm stuck with a nasty
>>issue. For some weird reason, CPU usage hits 99% some times. So I fired
>>up the VC6 profiler, the results are attached.
>>
>>98% of the time is spend inside CWinThread::PumpMessage
>>But that's a simple function, how can so much time be spend there?
>>
>>Profile: Function timing, sorted by time
>>Date: Sun Apr 11 21:12:13 2004
>>
>>
>>Program Statistics
>>------------------
>> Command line at 2004 Apr 11 20:57: "F:\VC\xbt\XBT Client\Debug\XBT
>>Client"
>> Total time: 76459,318 millisecond
>> Time outside of functions: 20,774 millisecond
>> Call depth: 36
>> Total functions: 3188
>> Total hits: 1435373
>> Function coverage: 39,6%
>> Overhead Calculated 2
>> Overhead Average 2
>>
>>Module Statistics for xbt client.exe
>>------------------------------------
>> Time in module: 76438,544 millisecond
>> Percent of time in module: 100,0%
>> Functions in module: 3188
>> Hits in module: 1435373
>> Module function coverage: 39,6%
>>
>> Func Func+Child Hit
>> Time % Time % Count Function
>>---------------------------------------------------------
>> 75351,273 98,6 75773,696 99,1 1437
>>CWinThread::PumpMessage(void) (mfc42d.dll)
>> 75,806 0,1 75,806 0,1 58546 operator delete(void *)
>>(mfc42d.dll)
>> 73,318 0,1 107,126 0,1 155186
>>std::allocator<bool>::destroy(bool *) (bt_file.obj)
>
>
>
- Next message: Olaf van der Spek: "Re: 99% CPU usage in CWinThread::PumpMessage"
- Previous message: Daniel James: "Re: C++ Standard Library"
- In reply to: KS: "Re: 99% CPU usage in CWinThread::PumpMessage"
- Next in thread: KS: "Re: 99% CPU usage in CWinThread::PumpMessage"
- Reply: KS: "Re: 99% CPU usage in CWinThread::PumpMessage"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|