Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JVM - Reducing number of CPUs..

 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Windows Task Manager, you can do Set Affinity on a process, to adjust which CPU(s) it runs on.

Does that help?
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic