linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* About effective resolution of cpu execution clocks
@ 2012-10-23 10:52 Miguel Telleria de Esteban
  0 siblings, 0 replies; only message in thread
From: Miguel Telleria de Esteban @ 2012-10-23 10:52 UTC (permalink / raw)
  To: RT

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-23 11:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-23 10:52 About effective resolution of cpu execution clocks Miguel Telleria de Esteban

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).