Hi !
I have one problem because one my application written in c++
occasionally used 100% of CPU.
Does anybody have any idea how to write a program, which report what is cause of that behavior or how to figure out why this happen?
Thanks.
Primoz.
I have one problem because one my application written in c++
occasionally used 100% of CPU.
Does anybody have any idea how to write a program, which report what is cause of that behavior or how to figure out why this happen?
Thanks.
Primoz.
"Occasionally use 100% cpu time" is a very common phenomenan. Why do you think a runnin process should not take 100% cpu time when it IS necessary?:)
Hi !
OK, First Issue:
When process started to use 100% CPU hangs up, and never
decrease usage...
Second:
- it's not anything different happening when process increase to 100 % CPU usage...
I would like to capture this event when CPU usage increase to figoure out where is the problem.
Do you have any other idea ?
Thank's for any help.
Primoz
OK, First Issue:
When process started to use 100% CPU hangs up, and never
decrease usage...
Second:
- it's not anything different happening when process increase to 100 % CPU usage...
I would like to capture this event when CPU usage increase to figoure out where is the problem.
Do you have any other idea ?
Thank's for any help.
Primoz
check any loops if you have them, it seems to me that a break condition is never met
or a function that "ran into" another /wo a ret. for example something like:
or something like that... happened to me a few times and my program also gets stuck doing a loop for a count that is very high (because it assumed a variable was set just before it was called)
push 5
call AA
...
AA proc
pop eax
sub eax,10
AA endp
BB proc
pop eax
...
ret
BB endp
or something like that... happened to me a few times and my program also gets stuck doing a loop for a count that is very high (because it assumed a variable was set just before it was called)
I have one problem because one my application written in c++ ...
I would like to capture this event when CPU usage increase to figoure out where is the problem.
Do you have any other idea ?
debug it using a debugger? or place something like this on a particular loop?I would like to capture this event when CPU usage increase to figoure out where is the problem.
Do you have any other idea ?
for( ;; )
{
//console
cout<<"REAL MEN CODE IN HEX :-) - This sh*tty loop is causing the problem."<<endl;
//win32
Messagebox(NULL, "REAL MEN CODE IN HEX :-) - This sh*tty loop is causing the problem.", "Non-Terminating Loop", MB_OK);
}
If you see an undending repetition of this text/messagebox then that's the bugger!!! :)Hi !
OK, possible causes (from your replays)
- infinitve loop
- variable was set just before it was called
It is possible to use somthing like:
- when access violation happens -> Dr. Watson (example)
- when process hangs-up || strat to using 100% - > CPU hook
Does anyone written any "CPU hook" or have any idea how to write it ?
It's seems to me that this is very interesting ???
Regards,
Primoz.
OK, possible causes (from your replays)
- infinitve loop
- variable was set just before it was called
It is possible to use somthing like:
- when access violation happens -> Dr. Watson (example)
- when process hangs-up || strat to using 100% - > CPU hook
Does anyone written any "CPU hook" or have any idea how to write it ?
It's seems to me that this is very interesting ???
Regards,
Primoz.
Windows NT OSes have the system monitor to watch for such things. It should be incorporatable into your program. Look on MSDN for some articles about it. It has been written about in MSJ/MSDN magazine before.