Re: Inconsistent CPU usage
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 30 Apr 2008 13:43:48 -0700
Elliot wrote:
On Apr 29, 5:46 pm, Knute Johnson <nos...@xxxxxxxxxxxxxxxxxxxxxxx>
wrote:
Elliot wrote:Hiwhile(!pW.isFinished){;}; // programmatic block to put up screen
Our Java Swing application uses sockets to communicate with a backend
Cobol database application. On 10% of the machines where the
application is running CPU usage goes to 100% at startup. On the
other 90% of the machines CPU usage is around 50%.
I develop on a P4 3.06 Gh Dell with XP SP2 and 1 gig of ram and run
at 50%. At one of our clients with the same P4 3.06 Gh and 2 gigs of
ram the application loads much slower and runs at 100%.
Perhaps the coding is part of the problem. A login screen is displayed
at the start of the application. In order to get the application to
stop and wait for user input the following line of code was used.
while(!pW.isFinished){;}; // programmatic block to put up screen
This waits (by looping) for the boolean to be set to true while the
password is verified via the socket connection with Cobol.
However, it takes many seconds to even get to this line. Java just
seems really slow to load.
I'm wondering how to understand the difference between the machines. I
also wonder if there are any java startup options that might help.
Both machines are using java "1.6.0_05" and we are loading a jar
file. Any ideas are most welcome
Thanks
Elliot
If the rest of your code looks at all like this, I'm surprised it runs
at all. You just cannot do this with Java and expect anything to work.
--
Knute Johnson
email s/nospam/linux/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Knute - not really a helpful comment. How about pointing people in the
right direction?
Well what did you expect when you posted that code? It is obvious you have no idea what you are doing. That code will eat up every bit of processor time it can and that is probably why your program takes so long to do anything else. You aren't clear whether this is a Swing GUI program or not but if that code is running in your EDT, nothing else is going to work right.
The fact that you don't know that makes it very difficult to answer your question, which is probably a side effect rather than your problem.
You need to post enough of a description and/or your code, GUI (AWT or Swing), command line, single or multi-threaded, and OS environment and problem so that people really have an idea what you want to know. Posting a SSCCE is also very helpful.
A guy goes into the doctor and says "doctor it hurts when I do that" and the doctor says "well don't do that anymore."
--
Knute Johnson
email s/nospam/linux/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
.
- References:
- Inconsistent CPU usage
- From: Elliot
- Re: Inconsistent CPU usage
- From: Knute Johnson
- Re: Inconsistent CPU usage
- From: Elliot
- Inconsistent CPU usage
- Prev by Date: Re: Thread safety and atomic assignment (again)
- Next by Date: Re: What is Premature Optimization?
- Previous by thread: Re: Inconsistent CPU usage
- Next by thread: Re: Inconsistent CPU usage
- Index(es):
Relevant Pages
|
|