All of lore.kernel.org
 help / color / mirror / Atom feed
* Some ideas about % of CPU for a process
@ 2004-11-12 18:47 Diego
  2004-11-12 18:55 ` Ed Schouten
  2004-11-12 19:45 ` Chris Friesen
  0 siblings, 2 replies; 4+ messages in thread
From: Diego @ 2004-11-12 18:47 UTC (permalink / raw)
  To: linux-kernel

Hi,
 I´m trying to define a % of cpu for a process, but i don´t have idea
about how i can do it. For example, i said that my process need 40% of
CPU during its lifetime, how can i do it in kernel 2.6?
Thanks for ideas.



Diego.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Some ideas about % of CPU for a process
  2004-11-12 18:47 Some ideas about % of CPU for a process Diego
@ 2004-11-12 18:55 ` Ed Schouten
  2004-11-12 19:30   ` Valdis.Kletnieks
  2004-11-12 19:45 ` Chris Friesen
  1 sibling, 1 reply; 4+ messages in thread
From: Ed Schouten @ 2004-11-12 18:55 UTC (permalink / raw)
  To: Diego; +Cc: Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

Hello Diego,

On Fri 12 Nov 2004 03:47 PM, Diego wrote:
> I'm trying to define a % of cpu for a process, but i don?t have idea
> about how i can do it. For example, i said that my process need 40% of
> CPU during its lifetime, how can i do it in kernel 2.6?
> Thanks for ideas.

Why don't you 'ps' the process and divide the running time through the
starting time?

        time
  ----------------  =  average process cpu usage
  (now - started))

Yours,
-- 
 Ed Schouten <ed@il.fontys.nl>
 Website: http://g-rave.nl/
 GPG key: finger ed@il.fontys.nl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Some ideas about % of CPU for a process
  2004-11-12 18:55 ` Ed Schouten
@ 2004-11-12 19:30   ` Valdis.Kletnieks
  0 siblings, 0 replies; 4+ messages in thread
From: Valdis.Kletnieks @ 2004-11-12 19:30 UTC (permalink / raw)
  To: Ed Schouten; +Cc: Diego, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]

On Fri, 12 Nov 2004 19:55:33 +0100, Ed Schouten said:

> On Fri 12 Nov 2004 03:47 PM, Diego wrote:
> > I'm trying to define a % of cpu for a process, but i don?t have idea
> > about how i can do it. For example, i said that my process need 40% of
> > CPU during its lifetime, how can i do it in kernel 2.6?
> > Thanks for ideas.
> 
> Why don't you 'ps' the process and divide the running time through the
> starting time?

I think he's trying to make a 40% *allotment* - as in "this number cruncher
is authorized to take 40% of the CPU for the next 6 hours".  The devil always
ends up being in the details however - things I've seen scheduling systems
fail with in the past:

1) Process is allowed to take 40% of the CPU, but so overcommits memory that
it can't actually *get* it because 65% of the time, the system is in a page
wait from the swap partition. (iterate across any *other* shared resource
that isn't directly tied to CPU).

2) Process is allowed to take 40% of the CPU, and no more - and somebody gets
torqued off because the system is 60% idle.

3) Process is allowed to take 40% at all times, and more if available - and
somebody gets torqued off because it's slow to notice the system has bogged
down - so it's still getting 60% for another 2-3 minutes when we're loaded
before the scheduler catches up.

4) And you always get the whiner who complains it's getting 39% or 41%. ;)

Saying "40% of the CPU" is easy - the fun is in the corner cases...

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Some ideas about % of CPU for a process
  2004-11-12 18:47 Some ideas about % of CPU for a process Diego
  2004-11-12 18:55 ` Ed Schouten
@ 2004-11-12 19:45 ` Chris Friesen
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Friesen @ 2004-11-12 19:45 UTC (permalink / raw)
  To: Diego; +Cc: linux-kernel

Diego wrote:
> Hi,
>  I´m trying to define a % of cpu for a process, but i don´t have idea
> about how i can do it. For example, i said that my process need 40% of
> CPU during its lifetime, how can i do it in kernel 2.6?

Take a look at CKRM.

Chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-11-12 19:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-12 18:47 Some ideas about % of CPU for a process Diego
2004-11-12 18:55 ` Ed Schouten
2004-11-12 19:30   ` Valdis.Kletnieks
2004-11-12 19:45 ` Chris Friesen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.