Re: Limit CPU usage of a process?

2018-05-30 Thread Kevin Chadwick
On Wed, 30 May 2018 11:49:04 +0200


> Are these commandline options or stuff you have to program into your
> apps? They also seem to be more geared towards giving different
> processes different priorities of which gets to use the highest CPU.
> 

You could set your processor performance low with apm to keep it cooler
and use nice to keep other things faster but you would lose performance
obv. A single threaded browser would be limited to one core too so you
could look into firefox options there but may get more heat/power usage.

I still feel this is coping with a problem rather than fixing it but
understand this may be out of your control. I have used a percentage on
a Windows box once to stop it overheating and switching off (apm would
work better here) and affinity to make GTAV not starve the OS and stop
the road from disappearing when driving fast but for open source I am
not sure I have ever needed it? You could always kill a process if it is
misbehaving.



Re: Limit CPU usage of a process?

2018-05-30 Thread BergenBergen BergenBergen
Are these commandline options or stuff you have to program into your apps?
They also seem to be more geared towards giving different processes
different priorities of which gets to use the highest CPU.

This doesn't seem to be very helpful for us who are looking for a simple
commandline option which lets you set max CPU usage in percentage for any
given process.

https://github.com/opsengine/cpulimit did this, which is the closest thing
I've found so far.

All the best,
Murk



On Tue, May 29, 2018 at 8:48 PM, Raul Miller  wrote:

> There's https://man.openbsd.org/nice.1
>
> You might be describing https://man.openbsd.org/setrlimit.2 or the
> ulimit shell builtin (ulimit -t). But you might not want what you are
> describing, if that is the case.
>
> --
> Raul
>
>
> On Tue, May 29, 2018 at 2:35 PM, BergenBergen BergenBergen
>  wrote:
> > Browser or not, how *does* one cap CPU resources though? I think it's a
> > very interesting question, and I'm sorta baffled by the fact that the
> > demand for this kinda thing hasn't been any higher.
> >
> > All the best,
> > Murk
> >
> > On Tue, May 29, 2018 at 8:10 PM, Dumitru Mișu Moldovan 
> > wrote:
> >
> >> On 05/27/18 13:07, Maximilian Pichler wrote:
> >>
> >>> Is it possible to limit the CPU usage of a given process to, say, 20%?
> >>>
> >>> I'd like to slow down the web browser since it is draining my laptop's
> >>> battery. With enough tabs open it's often consuming ~50% of CPU but
> >>> not doing anything productive. Apparently with RLIMIT_CPU in
> >>> setrlimit(2) the total CPU time of a process can be limited. Can a
> >>> similar limit be set for the percentage?
> >>>
> >>
> >> Honest question…  Have you tried blocking ads with something like uBlock
> >> Origin?  I use several approaches to make web browsing palatable on old
> >> hardware, and blocking ads is what makes the biggest difference for me.
> >> (Using NoScript or equivalents to selectively enable JavaScript for
> sites
> >> where I actually need it is a distant second.)
> >>
> >> Capping CPU resources is not the way to go on a laptop in my opinion,
> >> unless you have some demanding job that always runs in the background in
> >> your browser, and that's a problem by itself in your scenario.  Capping
> >> will not change the fact that you'll still spend the same resources on
> >> loading web pages, however it will slow you down and annoy you.
> >>
> >>
>


Re: Limit CPU usage of a process?

2018-05-29 Thread Raul Miller
There's https://man.openbsd.org/nice.1

You might be describing https://man.openbsd.org/setrlimit.2 or the
ulimit shell builtin (ulimit -t). But you might not want what you are
describing, if that is the case.

-- 
Raul


On Tue, May 29, 2018 at 2:35 PM, BergenBergen BergenBergen
 wrote:
> Browser or not, how *does* one cap CPU resources though? I think it's a
> very interesting question, and I'm sorta baffled by the fact that the
> demand for this kinda thing hasn't been any higher.
>
> All the best,
> Murk
>
> On Tue, May 29, 2018 at 8:10 PM, Dumitru Mișu Moldovan 
> wrote:
>
>> On 05/27/18 13:07, Maximilian Pichler wrote:
>>
>>> Is it possible to limit the CPU usage of a given process to, say, 20%?
>>>
>>> I'd like to slow down the web browser since it is draining my laptop's
>>> battery. With enough tabs open it's often consuming ~50% of CPU but
>>> not doing anything productive. Apparently with RLIMIT_CPU in
>>> setrlimit(2) the total CPU time of a process can be limited. Can a
>>> similar limit be set for the percentage?
>>>
>>
>> Honest question…  Have you tried blocking ads with something like uBlock
>> Origin?  I use several approaches to make web browsing palatable on old
>> hardware, and blocking ads is what makes the biggest difference for me.
>> (Using NoScript or equivalents to selectively enable JavaScript for sites
>> where I actually need it is a distant second.)
>>
>> Capping CPU resources is not the way to go on a laptop in my opinion,
>> unless you have some demanding job that always runs in the background in
>> your browser, and that's a problem by itself in your scenario.  Capping
>> will not change the fact that you'll still spend the same resources on
>> loading web pages, however it will slow you down and annoy you.
>>
>>



Re: Limit CPU usage of a process?

2018-05-29 Thread BergenBergen BergenBergen
Browser or not, how *does* one cap CPU resources though? I think it's a
very interesting question, and I'm sorta baffled by the fact that the
demand for this kinda thing hasn't been any higher.

All the best,
Murk

On Tue, May 29, 2018 at 8:10 PM, Dumitru Mișu Moldovan 
wrote:

> On 05/27/18 13:07, Maximilian Pichler wrote:
>
>> Is it possible to limit the CPU usage of a given process to, say, 20%?
>>
>> I'd like to slow down the web browser since it is draining my laptop's
>> battery. With enough tabs open it's often consuming ~50% of CPU but
>> not doing anything productive. Apparently with RLIMIT_CPU in
>> setrlimit(2) the total CPU time of a process can be limited. Can a
>> similar limit be set for the percentage?
>>
>
> Honest question…  Have you tried blocking ads with something like uBlock
> Origin?  I use several approaches to make web browsing palatable on old
> hardware, and blocking ads is what makes the biggest difference for me.
> (Using NoScript or equivalents to selectively enable JavaScript for sites
> where I actually need it is a distant second.)
>
> Capping CPU resources is not the way to go on a laptop in my opinion,
> unless you have some demanding job that always runs in the background in
> your browser, and that's a problem by itself in your scenario.  Capping
> will not change the fact that you'll still spend the same resources on
> loading web pages, however it will slow you down and annoy you.
>
>


Re: Limit CPU usage of a process?

2018-05-29 Thread Dumitru Mișu Moldovan

On 05/27/18 13:07, Maximilian Pichler wrote:

Is it possible to limit the CPU usage of a given process to, say, 20%?

I'd like to slow down the web browser since it is draining my laptop's
battery. With enough tabs open it's often consuming ~50% of CPU but
not doing anything productive. Apparently with RLIMIT_CPU in
setrlimit(2) the total CPU time of a process can be limited. Can a
similar limit be set for the percentage?


Honest question…  Have you tried blocking ads with something like uBlock 
Origin?  I use several approaches to make web browsing palatable on old 
hardware, and blocking ads is what makes the biggest difference for me. 
(Using NoScript or equivalents to selectively enable JavaScript for 
sites where I actually need it is a distant second.)


Capping CPU resources is not the way to go on a laptop in my opinion, 
unless you have some demanding job that always runs in the background in 
your browser, and that's a problem by itself in your scenario.  Capping 
will not change the fact that you'll still spend the same resources on 
loading web pages, however it will slow you down and annoy you.




signature.asc
Description: OpenPGP digital signature


Re: Limit CPU usage of a process?

2018-05-27 Thread Tom Smyth
would the renice command be of any use ... to change the priority of
the process ?


On 27 May 2018 at 22:09, BergenBergen BergenBergen
 wrote:
>  I'd much rather prefer a generic tool that could limit any process, rather
> than trying to come up with ways to strip down ones browser.
>
> FreeBSD has a cpulimit (https://github.com/opsengine/cpulimit/) port, and
> it would be nice if OpenBSD could too. I'm not skilled enough to make one,
> but I'd gladly make a donation to whomever could.
>
> Regards,
> Murk
>
>
> On Sun, May 27, 2018 at 10:34 PM, Consus  wrote:
>
>> On 20:02 Sun 27 May, Kevin Chadwick wrote:
>> > Umatrix is a good javascript control extension. Some websites are even
>> > running bitcoin mining without asking your permission. Theft of
>> > electricity in my book.
>>
>> Hell, javascript itself is a theft of electricity.
>>
>>



-- 
Kindest regards,
Tom Smyth

Mobile: +353 87 6193172
The information contained in this E-mail is intended only for the
confidential use of the named recipient. If the reader of this message
is not the intended recipient or the person responsible for
delivering it to the recipient, you are hereby notified that you have
received this communication in error and that any review,
dissemination or copying of this communication is strictly prohibited.
If you have received this in error, please notify the sender
immediately by telephone at the number above and erase the message
You are requested to carry out your own virus check before
opening any attachment.



Re: Limit CPU usage of a process?

2018-05-27 Thread e

On 05/27/2018 10:02 PM, Kevin Chadwick wrote:

Umatrix is a good javascript control extension. Some websites are even running 
bitcoin mining without asking your permission. Theft of electricity in my book.

Once I encountered a mining site. The mining itself got annoying pretty 
fast. The browser UI got sluggish and inspector showed that the GPU is 
in heavy use. Also, the laptop vents kicked on instantly.





Re: Limit CPU usage of a process?

2018-05-27 Thread BergenBergen BergenBergen
 I'd much rather prefer a generic tool that could limit any process, rather
than trying to come up with ways to strip down ones browser.

FreeBSD has a cpulimit (https://github.com/opsengine/cpulimit/) port, and
it would be nice if OpenBSD could too. I'm not skilled enough to make one,
but I'd gladly make a donation to whomever could.

Regards,
Murk


On Sun, May 27, 2018 at 10:34 PM, Consus  wrote:

> On 20:02 Sun 27 May, Kevin Chadwick wrote:
> > Umatrix is a good javascript control extension. Some websites are even
> > running bitcoin mining without asking your permission. Theft of
> > electricity in my book.
>
> Hell, javascript itself is a theft of electricity.
>
>


Re: Limit CPU usage of a process?

2018-05-27 Thread Consus
On 20:02 Sun 27 May, Kevin Chadwick wrote:
> Umatrix is a good javascript control extension. Some websites are even
> running bitcoin mining without asking your permission. Theft of
> electricity in my book.

Hell, javascript itself is a theft of electricity.



Re: Limit CPU usage of a process?

2018-05-27 Thread Kevin Chadwick
Umatrix is a good javascript control extension. Some websites are even running 
bitcoin mining without asking your permission. Theft of electricity in my book.



Re: Limit CPU usage of a process?

2018-05-27 Thread Thomas Huber
ksh(1) has ulimit comand to limit process in certain way. just search for
ulimit on the ksh man-page.

On 27 May 2018 at 18:28, Luke A. Call  wrote:

> I had that problem but turning off javascript (as someone else said),
> turning off images most of the time, and bookmarking the tab group then
> closing as many tabs as I wasn't actually going to use soonest (especially
> any viewing PDF files), dropped it down to ~4%.
>
> On 05-27 12:07:16+0200, Maximilian Pichler wrote:
> > Is it possible to limit the CPU usage of a given process to, say, 20%?
> >
> > I'd like to slow down the web browser since it is draining my laptop's
> > battery. With enough tabs open it's often consuming ~50% of CPU but
> > not doing anything productive. Apparently with RLIMIT_CPU in
> > setrlimit(2) the total CPU time of a process can be limited. Can a
> > similar limit be set for the percentage?
> >
> > Thanks
> >
>
>


-- 
+49.179.1448024
Karl-Kunger-Straße 68
D - 12435 Berlin


Re: Limit CPU usage of a process?

2018-05-27 Thread Luke A. Call
I had that problem but turning off javascript (as someone else said), turning 
off images most of the time, and bookmarking the tab group then closing as many 
tabs as I wasn't actually going to use soonest (especially any viewing PDF 
files), dropped it down to ~4%.

On 05-27 12:07:16+0200, Maximilian Pichler wrote:
> Is it possible to limit the CPU usage of a given process to, say, 20%?
> 
> I'd like to slow down the web browser since it is draining my laptop's
> battery. With enough tabs open it's often consuming ~50% of CPU but
> not doing anything productive. Apparently with RLIMIT_CPU in
> setrlimit(2) the total CPU time of a process can be limited. Can a
> similar limit be set for the percentage?
> 
> Thanks
> 



Re: Limit CPU usage of a process?

2018-05-27 Thread BergenBergen BergenBergen
Have a look at
http://openbsd-archive.7691.n7.nabble.com/Port-request-cpulimit-td267083.html
and please let me know how it went!

All the best,
Murk



On Sun, May 27, 2018 at 12:07 PM, Maximilian Pichler <
maxim.pich...@gmail.com> wrote:

> Is it possible to limit the CPU usage of a given process to, say, 20%?
>
> I'd like to slow down the web browser since it is draining my laptop's
> battery. With enough tabs open it's often consuming ~50% of CPU but
> not doing anything productive. Apparently with RLIMIT_CPU in
> setrlimit(2) the total CPU time of a process can be limited. Can a
> similar limit be set for the percentage?
>
> Thanks
>
>


Re: Limit CPU usage of a process?

2018-05-27 Thread justina colmena
On May 27, 2018 2:07:16 AM AKDT, Maximilian Pichler  
wrote:
>Is it possible to limit the CPU usage of a given process to, say, 20%?
>
>I'd like to slow down the web browser since it is draining my laptop's
>battery. With enough tabs open it's often consuming ~50% of CPU but
>not doing anything productive. Apparently with RLIMIT_CPU in
>setrlimit(2) the total CPU time of a process can be limited. Can a
>similar limit be set for the percentage?
>
>Thanks

Use the "ulimit" command within ksh(1).

A lot of websites these days run malicious JavaScript to mine for Bitcoin on 
their client's computers.


--
https://www.colmena.biz/~justina/contacto.php



Limit CPU usage of a process?

2018-05-27 Thread Maximilian Pichler
Is it possible to limit the CPU usage of a given process to, say, 20%?

I'd like to slow down the web browser since it is draining my laptop's
battery. With enough tabs open it's often consuming ~50% of CPU but
not doing anything productive. Apparently with RLIMIT_CPU in
setrlimit(2) the total CPU time of a process can be limited. Can a
similar limit be set for the percentage?

Thanks