Page 6 of 13 FirstFirst ... 45678 ... LastLast
Results 51 to 60 of 122

Thread: HOWTO: Set maximum CPU consumption in percentage by any process

  1. #51
    Join Date
    Mar 2007
    Beans
    680

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    malyvelky,
    I have tested and I have changed the code according to your suggestion (instead of grep I have used "grep -E"), to make code working on all of Ubuntu versions. I have changed daemon and publish changes in the first post of this thread.
    Thanks for testing and reporting problems.
    Regards
    Last edited by abcuser; January 4th, 2010 at 05:37 PM.

  2. #52
    Join Date
    Mar 2007
    Beans
    680

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    Hi,
    today I have added some major changes to boot-up script, with additional checkings, which makes script more stable if manually using start/stop/restart service commands.

    I have also rewritten tutorial to add new info and remove as much confusion as possible.

    I would be very happy if you could test this daemon script and report, if it is working for you. Also post here if you would like to have any additional functionality.
    Regards

  3. #53
    Join Date
    Feb 2010
    Beans
    3
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    Hi,

    I don't know if this is the appropriate thread for this question but here goes..

    I am running ubuntu on an embedded board( gumstix overo fire) which has an ARM cortex-A8 600Mhz. I am using it to run an algorithm which is initiated every 100ms as new data comes in from a sensor.

    My algorithm takes about 30ms-50ms to run. When i ran top i noticed that it is using only 30% cpu resources. Is there anyway to make the code utilize cpu more effectively?

    I have tried using nice -20. Or is it showing 30% as the code is running only for 30ms every 100ms and hence is utilizing CPU effectively?

    Any help would be appreciated.

    Pranay

  4. #54
    Join Date
    Sep 2009
    Beans
    1

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    I just wanted to say that could not get the startup script to work on centos 5.3 without removeing the following line:
    . /lib/lsb/init-functionsing

  5. #55
    Join Date
    Mar 2007
    Beans
    680

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    @ebrajoh, you are most probably right. I have just copied the following header:
    Code:
    #!/bin/sh
    #
    # Script to start CPU limit daemon
    #
    set -e
    . /lib/lsb/init-functions
    from some other script and didn't really check if they are really needed.
    Last edited by abcuser; August 20th, 2010 at 08:27 AM.

  6. #56
    Join Date
    Mar 2007
    Beans
    680

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    pranaynewton, you should probably open new thread because this thread if for making limitation on CPU using and you would like to do vise-versa.

    It looks like in your case the bottleneck is not a CPU. So you can't use more then 30% CPU if there is no need to use it more.
    Last edited by abcuser; August 20th, 2010 at 08:39 AM.

  7. #57
    Join Date
    Mar 2007
    Beans
    680

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    Quote Originally Posted by ebrajoh View Post
    I just wanted to say that could not get the startup script to work on centos 5.3 without removeing the following line:
    . /lib/lsb/init-functionsing
    @ebrajoh, I have just copied this line from some other script and now I have tested the script without this line on Ubuntu 8.04 LTS and Ubuntu 10.04 LTS and it is working fine. So I have updated the first post in this thread (deleted the line from script). Thanks a lot for posting this issue. Now it should also work on centos.

    I have also made some minor changes in tutorial, to make it more clear. E.g. scripts must be saved with root privileges otherwise system will report "no privileges to save a file".

    If you find some bugs in scripts or tutorial please post it on this forum. Also post a note if you have some suggestion how to improve tutorial/scripts.
    Last edited by abcuser; August 20th, 2010 at 08:41 AM.

  8. #58
    Join Date
    Nov 2008
    Location
    Oita, Japan
    Beans
    431
    Distro
    Ubuntu

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    On 10.04 i can't get the daemon to start...
    Code:
    $ sudo service cpulimit start
     * cpulimit daemon can not be started
    $
    I've changed one part, and put the script in /usr/local/sbin (where I keep all user scripts), but I made sure to make the appropriate changes to /etc/init.d/cpulimit.... other than that I followed the guide.

  9. #59
    Join Date
    Mar 2007
    Beans
    680

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    @quequotion, can you please do the following:
    1. Check if the file is in this path and what are permissions on file:
    Code:
    ls -l /usr/local/sbin/cpulimit_daemon.sh
    2. Before starting a cpulimit daemon please execute the following command to list if daemon is already started.
    Code:
    ps -eo pid,args | gawk '/cpulimit_daemon/'
    3. Please also execute this command to check if some process of cpulimit is already running:
    Code:
    ps aux | grep cpulimit | grep -v grep
    4. Try to manually start a cpulimit daemon:
    Code:
    sudo service cpulimit start
    (this will most probably produce the error in your case)
    5. Now execute the command from step 2 again.
    6. Now execute the command from step 3 again.
    Please post the output of all 6 steps.

    Can you please also post the script from /etc/init.d/cpulimit to see if you made a proper changes.
    Last edited by abcuser; September 19th, 2010 at 08:26 AM.

  10. #60
    Join Date
    Dec 2010
    Beans
    2

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    great tip

    works quite good
    thanks

Page 6 of 13 FirstFirst ... 45678 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •