public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Korty <joe.korty@ccur.com>
To: "Koehrer Mathias (ETAS/ESW5)" <mathias.koehrer@etas.com>
Cc: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>
Subject: Re: How to measue the total CPU specific load (including real time tasks)?
Date: Wed, 8 Jul 2015 13:19:43 -0400	[thread overview]
Message-ID: <20150708171943.GA11993@zipoli.ccur.com> (raw)
In-Reply-To: <0b987de237404a13b1753e28e3853d2f@FE-MBX1012.de.bosch.com>

On Tue, Jul 07, 2015 at 08:18:08AM -0400, Koehrer Mathias (ETAS/ESW5) wrote:
> Hi all,
> 
> we use the RT_PREEMPT kernel fairly long now and it is working really fine.
> However, I have one question that is related to measure the available "CPU
> headroom" on all available CPU cores.  We are using an Intel Core i7 PC
> (32 and 64bit, Debian distribution, vanilla kernel + rt_preempt patch).
> The question is the same for kernel 3.2.x and 3.18.x.
> 
> On the PC a couple of real time threads are running. They are hard bound
> to a particular CPU core (via pthread_setaffinity_np or sched_setaffinity).
> As we are using the boot parameter  "isolcpus=1-31", all processes run per
> default on CPU core 0.  Now, I want to measure the total CPU specific load.
> How can this be done easily?
> 
> When I use "top" in thread-mode I see the relative CPU load for particular
> threads/processes.  However the "idle" value in the "top" summary does
> not fit. With some experiments I saw the idle value for a CPU core to
> be nearly 100% even if on the very same CPU core a real time thread was
> consuming about 40% CPU time.  I looked into /proc/stat to take the idle
> tick value but this value seems not to consider the real time threads.
> 
> 
> The only approach I found so far is to parse all /proc/PID/stat files
> periodically and to extract the fields utime, stime, cutime, cstime,
> task_cpu. These values can be used to compute the CPU specific load.
> However, the effort to do so is really high.
> 
> Is there any /proc file (or something similar) I can use to get the total
> CPU specific load (including real time threads)?  Or do I have to enable
> a particular kernel configuration to get this value?
> 
> Thanks for any feedback on this question.
> 
> Regards
> Mathias


I think that if you turn on CONFIG_VIRT_CPU_ACCOUNTING_GEN,
you will get per-cpu high resolution idle time accounting
as a side effect.  (I'm looking at the 3.18 kernel, YMMV
for earlier kernels).

Regards,
Joe

  reply	other threads:[~2015-07-08 17:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07 12:18 How to measue the total CPU specific load (including real time tasks)? Koehrer Mathias (ETAS/ESW5)
2015-07-08 17:19 ` Joe Korty [this message]
2015-07-09 11:31   ` Koehrer Mathias (ETAS/ESW5)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150708171943.GA11993@zipoli.ccur.com \
    --to=joe.korty@ccur.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mathias.koehrer@etas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox