From: Miguel Telleria de Esteban <miguel@mtelleria.com>
To: RT <linux-rt-users@vger.kernel.org>
Subject: About effective resolution of cpu execution clocks
Date: Tue, 23 Oct 2012 12:52:49 +0200 [thread overview]
Message-ID: <20121023125249.776fa125@namir.ctr.unican.es> (raw)
[-- Attachment #1: Type: text/plain, Size: 2335 bytes --]
Dear all,
Please allow me to post this newbie question that must have been
answered many times before.
I have my doubts about the actual resolution of CPU TIME USAGE
MEASUREMENT for individual tasks, that is using the
clock_gettime()
with the thread clock id.
From one side, it looks as the counter of cpu-time use in each thread
is done with a jiffy resolution:
- utime and stime fields in task_struct seem to be unsigned long,
therefore in 32bit archs they cannot have a very high resolution.
http://lxr.linux.no/#linux+v3.6.3/kernel/posix-cpu-timers.c
http://lxr.linux.no/linux+*/include/linux/sched.h#L1362
http://lxr.linux.no/linux+*/include/asm-generic/cputime.h#L7
- utime and stime fields in /proc/<tid>/stat come out in jiffies
according to proc man page.
since I guess that these utime and stime fields are the basis of the
cpuclock implementation I infer that the effective resolution of
thread or process usage is limited by the jiffy resolution (4msg with
CONFIG_HZ=250) of the utime and stime fields in task_struct.
On the other side, clock_getres() returns 1 nanosec and the well known
hrtimers merge in 2.6.21 announced highly and broadly that the jiffy
barrier has been lifted with real time clocks and timers.
So my questions are:
* What is the effective resolution of two invocations of
clock_gettime() on the same running thread for a long period
involving several CPU preemptions?
* Are there other fields apart from stime and utime with the
sufficient precision to maintain a CPU usage count?
* Does the PREEMPT_RT branch improve this resolution somehow?
Thanks in advance for your time.
Cheers,
Miguel Telleria
--
(O-O)
---oOO-(_)-OOo-----------------------------------------------------
Miguel TELLERIA DE ESTEBAN http://www.mtelleria.com
Email: miguel at mtelleria.com Tel GSM: +34 650 801098
Tel Fix: +34 942 280174
Miembro de http://www.linuca.org Membre du http://www.bxlug.be
¿Usuario captivo o libre? http://www.obtengalinux.org/windows/
Free or captive user? http://www.getgnulinux.org/windows/
-------------------------------------------------------------------
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
reply other threads:[~2012-10-23 11:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20121023125249.776fa125@namir.ctr.unican.es \
--to=miguel@mtelleria.com \
--cc=linux-rt-users@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).