How to hobble a CPU

S

Solostian

Hi,

I need to conduct a series of performance tests. Unfortunately, my
workstation way more powerful than the targeted workstations. I need to
design a script that will allow me to cut down the overall CPU power by
a set % value.

Does anyone knows if this is possible at all with Perl?
Where would I first need to look?

Regards,
Solostian
 
C

Colin B.

Solostian said:
Hi,

I need to conduct a series of performance tests. Unfortunately, my
workstation way more powerful than the targeted workstations. I need to
design a script that will allow me to cut down the overall CPU power by
a set % value.

Does anyone knows if this is possible at all with Perl?
Where would I first need to look?

The first place to look is at the question. Do you really need to scale your
computer down, or can you scale the results down instead? If the job is CPU
bound, it should certainly be possible.

Secondly, you might be able to use zones and CPU partitioning to accomplish
it. Create a second zone that is able to use 2/3 of the total CPU cycles,
and then run something in it that will peg it 100%. In another zone, you are
then limited to only the remaining third of CPU power. Roughly.
 
A

ashish

To get 50% of CPU scheduling time for your process, run one another
process doing computation in an infinite loop, in the background. Using
round robin scheduling and assuming same priority for processes, it
will force the CPU to atleast devote 50% of time to that process, if
two processes are running.
To get 33% , run two such processes and so on.

For anything more precise, you will need a a combination of full
throttle processes like the above + another process which does
computation and sleep alternatively so as to achieve the desired
computation. For example, to get only 30% of CPU to yourself, you will
need to run 2 processes full throttle and then another process
computing only 33% of its scheduled cpu time. This is equal to 2.3
processes running full time. This plus yours is 3.3 , thus each process
gets 100/3.3 = 30% CPU scheduling time.

Ashish
 
A

ashish

To get 50% of CPU scheduling time for your process, run one another
process doing computation in an infinite loop, in the background. Using
round robin scheduling and assuming same priority for processes, it
will force the CPU to atleast devote 50% of time to that process, if
two processes are running.
To get 33% , run two such processes and so on.

For anything more precise, you will need a a combination of full
throttle processes like the above + another process which does
computation and sleep alternatively so as to achieve the desired
computation. For example, to get only 30% of CPU to yourself, you will
need to run 2 processes full throttle and then another process
computing only 33% of its scheduled cpu time. This is equal to 2.3
processes running full time. This plus yours is 3.3 , thus each process
gets 100/3.3 = 30% CPU scheduling time.

Ashish
 
S

Solostian

Thank you all for your insights.

The reason I need to throttle down my workstation is to try and resolve
a timing issue that other slower workstations are having in a
client/server environment. They do not reply quickly enough, thus
generating timeouts, while mine replies in time.

Regards,
Solostian
 
T

Ted Zlatanov

To get 50% of CPU scheduling time for your process, run one another
process doing computation in an infinite loop, in the background. Using
round robin scheduling and assuming same priority for processes, it
will force the CPU to atleast devote 50% of time to that process, if
two processes are running.
To get 33% , run two such processes and so on.

This will not work on a multiprocessor system, as I pointed out in an
earlier post in this thread.

Ted
 
T

Ted Zlatanov

The reason I need to throttle down my workstation is to try and resolve
a timing issue that other slower workstations are having in a
client/server environment. They do not reply quickly enough, thus
generating timeouts, while mine replies in time.

Ah, in that case just add a second of sleep(1) before the reply so it
will always be too slow. If you need a shorter time, look at
"perldoc -q sleep"

Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top