How to hobble a CPU

Discussion in 'Perl Misc' started by Solostian, Jun 7, 2006.

  1. Solostian

    Solostian Guest

    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
     
    Solostian, Jun 7, 2006
    #1
    1. Advertising

  2. Solostian

    Colin B. Guest

    Solostian <> wrote:
    > 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.
     
    Colin B., Jun 7, 2006
    #2
    1. Advertising

  3. Solostian

    ashish Guest

    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

    Solostian wrote:
    > 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
     
    ashish, Jun 8, 2006
    #3
  4. Solostian

    ashish Guest

    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

    Solostian wrote:
    > 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
     
    ashish, Jun 8, 2006
    #4
  5. Solostian

    Solostian Guest

    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
     
    Solostian, Jun 8, 2006
    #5
  6. Solostian

    Ted Zlatanov Guest

    On 8 Jun 2006, wrote:

    > 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
     
    Ted Zlatanov, Jun 8, 2006
    #6
  7. Solostian

    Ted Zlatanov Guest

    On 8 Jun 2006, wrote:

    > 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
     
    Ted Zlatanov, Jun 8, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ¹Ú»óÈñ
    Replies:
    0
    Views:
    904
    ¹Ú»óÈñ
    Dec 22, 2003
  2. John

    Book on CPU Design

    John, Jun 29, 2003, in forum: VHDL
    Replies:
    3
    Views:
    13,437
    john jakson
    Jul 5, 2003
  3. Attila Csosz

    help in cpu design

    Attila Csosz, Aug 16, 2003, in forum: VHDL
    Replies:
    7
    Views:
    1,468
    Pieter Hulshoff
    Aug 17, 2003
  4. pavunkumar

    How , system cpu and user cpu times calculates

    pavunkumar, Feb 27, 2009, in forum: C Programming
    Replies:
    1
    Views:
    359
  5. Solostian

    How to hobble a CPU

    Solostian, Jun 7, 2006, in forum: Perl Misc
    Replies:
    2
    Views:
    74
    Ted Zlatanov
    Jun 7, 2006
Loading...

Share This Page