linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tcminyard@gmail.com (Corey Minyard)
To: linux-arm-kernel@lists.infradead.org
Subject: How to get better precision out of getrusage on the ARM?
Date: Wed, 20 Jan 2016 08:35:08 -0600	[thread overview]
Message-ID: <569F9B1C.4010806@gmail.com> (raw)
In-Reply-To: <CAF_dkJDfT9LkE+_jj0_0mr80MQhH3ktTtZ8XwC+J1eOYqYgenQ@mail.gmail.com>

On 01/19/2016 08:36 AM, Patrick Doyle wrote:
> On Mon, Jan 18, 2016 at 11:50 PM, Yang, Wenyou <wenyou.yang@atmel.com> wrote:
>> On 2016/1/2 2:14, Corey Minyard wrote:
>>> I have some patches at https://sourceforge.net/projects/microstate that
>>> add the ability to do accurate accounting of time, if you really need that.
>>
>> I want to run this similar tests on my side.
>>
>> It seems you don't use this project. What project do you use as your
>> application?  Could you give some information?
>>
>> Did your questions resolve?  What is remaining?
> Hello Wenyou,
> For my project, I was porting an existing application that ran on a
> custom embedded OS.  Part of that custom embedded OS provided
> per-thread CPU runtime timers.  As I looked around for a mechanism to
> implement that, I found clock_gettime(2) using the
> CLOCK_THREAD_CPUTIME_ID clk_id should provide the same capability in a
> Posix-ly correct manner.

Those numbers are still statistical by default.  It's the same numbers
as getrusage(), just in a POSIX interface.

I forgot, there is a new kernel option may provide what you need. It's
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE.  I have not tested this, but from
the description it may provide what you need.  It's only available on some
arches it appears.  There are some other timekeeping options in 
init/Kconfig,
you may want to look at those.

-corey

> The problem I ran into was the values returned by
> CLOCK_THREAD_CPUTIME_ID were quantized to multiples of the system tick
> frequency.  So I hacked up tcb_clksrc.c to register itself using
> CLOCKSOURCE_OF_DECLARE() and set the appropriate kernel options
> (CONFIG_HIGH_RES_TIMERS and CONFIG_NO_HZ_IDLE, I think, but I can't
> seem to find my notes or config files from that work -- I hate Monday
> mornings, even virtual ones!).  As I noted in my previous email, I am
> not happy with my changes to tcb_clksrc.c and would like the
> opportunity to discuss them with you and your colleagues at Atmel and
> figure out the best way to approach that.  I'm happy to send the
> patches to you, but I don't think they should go into the linux-at91
> tree without a lot more thought applied.
>
> --wpd

  parent reply	other threads:[~2016-01-20 14:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 14:30 How to get better precision out of getrusage on the ARM? Patrick Doyle
2015-12-22 14:49 ` Russell King - ARM Linux
2015-12-22 14:57   ` Patrick Doyle
2015-12-22 15:13     ` Russell King - ARM Linux
2015-12-22 16:28       ` Patrick Doyle
2015-12-22 21:23         ` Patrick Doyle
2015-12-30 15:00           ` Patrick Doyle
2015-12-30 15:52             ` Patrick Doyle
2016-01-01 18:14               ` Corey Minyard
2016-01-04 15:46                 ` Patrick Doyle
2016-01-19  4:50                 ` Yang, Wenyou
2016-01-19 14:36                   ` Patrick Doyle
2016-01-20  1:24                     ` Yang, Wenyou
2016-01-20 14:35                     ` Corey Minyard [this message]
2016-01-19  0:16             ` Alexandre Belloni
2016-01-19 14:19               ` Patrick Doyle

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=569F9B1C.4010806@gmail.com \
    --to=tcminyard@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).