CPU Usage jumps to 100%

  • Thread starter Thread starter David Schwartz
  • Start date Start date
D

David Schwartz

When I run my VB.NET Windows Forms application, the CPU usage jumps up to
100%. If I drop-down a menu, the usage goes down to a more reasonable
number, like 0-2%. The same is true when a MsgBox comes up.

Has anyone else noticed or experienced this? Why would this be? Is this
the norm for VB.NET apps?

Thanks in advance.
 
This is normal.

OHM#

David said:
When I run my VB.NET Windows Forms application, the CPU usage jumps
up to 100%. If I drop-down a menu, the usage goes down to a more
reasonable number, like 0-2%. The same is true when a MsgBox comes
up.

Has anyone else noticed or experienced this? Why would this be? Is
this the norm for VB.NET apps?

Thanks in advance.

Regards - OHM# (e-mail address removed)
 
Actually, are you saying once started the application continues to grab 100%
until you cause a dropdown event ?, if so this is not normal. The processing
time will peak when you start the application, but should not remain in this
state after loading unless you have some thread running or some event is
continually firing which doesent sound right.

There are some free profiler tools around which can assist you in finding
bottlenecks in your application.

This is normal.

OHM#



Regards - OHM# (e-mail address removed)

Regards - OHM# (e-mail address removed)
 
If this is normal, what would you say to users who complain about this?
Thanks.
 
* "David Schwartz said:
When I run my VB.NET Windows Forms application, the CPU usage jumps up to
100%. If I drop-down a menu, the usage goes down to a more reasonable
number, like 0-2%. The same is true when a MsgBox comes up.

Has anyone else noticed or experienced this? Why would this be? Is this
the norm for VB.NET apps?

Does it remain at 100% if you don't show a messagebox? Does that even
occur in a blank project? What are you doing at startup?
 
The OP's initial statement was not crystal clear really. I initially thought
he meant that the app peaked at 100% on startup, so I posted a follow up
question ( look above ) which he has not come back to.

I'm not sure if he has not had time, solved it or got annoyed ?

Regards - OHM


Does it remain at 100% if you don't show a messagebox? Does that even
occur in a blank project? What are you doing at startup?

Regards - OHM# (e-mail address removed)
 
Hi,

Something in your code is causing this. What are you doing after startup?

BTW, this IS NOT normal. However, there are things, like polling loops,
that will/can result in 100% processor usage. Also, not, that 100%
processor usage means that your process is consuming 100% of the time
allocated to it, not that it is consuming 100% of all possible time --
multitasking still works, though other apps may be slowed.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 
Thanks for the responses everyone. I solved the problem.

Don't laugh, but this is what it was:

At the end of Sub Main, there was an infinite loop with a DoEvents in it!
The purpose of this loop was apparently to keep Sub Main from ending and the
app terminating as a result. I got rid of the infinite loop and moved the
Sub Main code into a Startup form instead and now the CPU usage drops back
down after the app starts up.
 
Yeah Dick, read ALL the posts before replying. I followed up my post with a
caviat

OHM


Dick said:
Hi,

Something in your code is causing this. What are you doing after
startup?

BTW, this IS NOT normal. However, there are things, like polling
loops, that will/can result in 100% processor usage. Also, not, that
100% processor usage means that your process is consuming 100% of the
time allocated to it, not that it is consuming 100% of all possible
time -- multitasking still works, though other apps may be slowed.

Dick

Regards - OHM# (e-mail address removed)
 
Glad u solved it David.

Regards - OHM

David said:
Thanks for the responses everyone. I solved the problem.

Don't laugh, but this is what it was:

At the end of Sub Main, there was an infinite loop with a DoEvents in
it! The purpose of this loop was apparently to keep Sub Main from
ending and the app terminating as a result. I got rid of the
infinite loop and moved the Sub Main code into a Startup form instead
and now the CPU usage drops back down after the app starts up.

Regards - OHM# (e-mail address removed)
 
I did read them. I was adding a point.

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 
Back
Top