File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes JVM - Reducing number of CPUs.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JVM - Reducing number of CPUs.." Watch "JVM - Reducing number of CPUs.." New topic

JVM - Reducing number of CPUs..

Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1066
I was wondering if there is a way to reduce the number of CPUs on my Windows machine programmatically in Java or atleast as a command line parameter to the JVM. I would like my tests to run with just 1 CPU on the Windows(XP Prof) machine, just to check performance.

I googled on the net and found that it can be done by making a change to the registry, but I am not comfortable doing that.

- Vishwa
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
In Windows Task Manager, you can do Set Affinity on a process, to adjust which CPU(s) it runs on.

Does that help?

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1066
thanks Pete,
that worked! I was using eclipse, so I set the Affinity(Number of CPUs) to the eclipse process and it launched my JVM with just one 1 cpu.
I checked up with the foll. call:

I agree. Here's the link:
subject: JVM - Reducing number of CPUs..
It's not a secret anymore!