All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Daniel Simon <Daniel.Simon@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] measuring tasks execution time
Date: Fri, 29 Jun 2007 17:00:39 +0200	[thread overview]
Message-ID: <46851E97.7030402@domain.hid> (raw)
In-Reply-To: <20070629164326.15579570@domain.hid>

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

Daniel Simon wrote:
> On Wed, 27 Jun 2007 13:56:04 +0200
> Jan Kiszka <jan.kiszka@domain.hid> wrote:
> 
>>> On Mon, 25 Jun 2007 18:55:45 +0200
>>> Jan Kiszka <jan.kiszka@domain.hid> wrote:
> 
>>>> My idea was to keep a persistent version the existing xnstat_runtime_t
>>>> instance in xnthread (and later on also xnintr). That one shall not be
>>>> reset on readout via /proc.
>>> Is it necessary to keep also the reset one?
>> Yep, at least virtually (as in my proposal): We are dumping CPU share
>> percentages in /proc, and those need to be calculated over the same
>> measurement period. Thus we restart the measurement each time the user
>> reads the stats.
>>
>>>> Let's try it like this: Change Xenomai so that it leaves the existing
>>>> xnthread_t::stat.account untouched when it reads /proc. Rather add
>>>> something like " last;" to xnthread_t::stat. On readout
>>>> for /proc output, 
> 
>> That's one spot, the other is xnpod_migrate_thread()
>> (xnstat_runtime_reset_stats()) IIRC.
> 
> ok, i've found only these two reset points.
> 
> the account structure is also partially touched by  xnstat_runtime_finalize()
> in pod.c, I don't understand when and why...

xnstat_runtime_finalize is called when a task passes away, i.e. you
wouldn't be able to retrieve it's stats later on anyway.

> 
>>>> account into last. For your task exectime, you can then read
>>>> xnthread_t::stat.account directly, because it will always reflect the
>>>> full task history. Would't this work better?
>> Jan
>>
> please find attached a new patch following these ideas:
>  (patch against svn trunk Revision: 2672) 
> 
> account is now persistent, its "start" field is the last_switch time, and the
> new xnstat_runtime_t "lastperiod" handles the past values necessary to compute
> the runtime values plot at snapshot time.
> 
> from a few trials, it seems that /proc/xenomai/stat still behaves normally (i.e.
> like in the original version where the first reading of stat does gives nothing
> for the tasks runtime?)

The first dump is always bogus as the task set changed since the
previous measurement date (here: Xenomai start-up time).

> 
> exectime returns likely values when a task is measured by another one, but self
> measurement (with the NULL task calling parameter in rt_task_inquire) sometime
> provides incoherent values (e.g. returns the period rather than the exectime,
> or returns non-monotonic exectime values...). 
> I could not manage to fix this bug upto now. 

I think I already see one, though it doesn't explain all your observed
behaviour to me:

> --- xenomai-orig/ksrc/skins/native/task.c	2007-06-28 10:20:17.000000000 +0200
> +++ xenomai/ksrc/skins/native/task.c	2007-06-28 17:20:29.000000000 +0200
> @@ -1144,7 +1144,10 @@
>  	info->cprio = xnthread_current_priority(&task->thread_base);
>  	info->status = xnthread_state_flags(&task->thread_base);
>  	info->relpoint = xntimer_get_date(&task->thread_base.ptimer);
> -
> +	if(task == xeno_current_task())
> +	  info->exectime = xnthread_get_exectime(&task->thread_base) + (xnstat_runtime_now() - xnthread_get_lastswitch(&task->thread_base));
> +	else 
> +	  info->exectime = xnthread_get_exectime(&task->thread_base);

Exectime is only updated on task switches. So you are not obtaining the true value when requesting your own data. Use the same formula for both cases.

> And unfortunately i'll be away and probably far from any xenomai-capable
> machine next week...
> 

OK. I'll try to look into this in the meantime. But I think it should be no problem to merge a final version even after the approaching 2.4-rc1, the patch is yet fairly confined.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2007-06-29 15:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07 16:23 [Xenomai-help] real time task disapears... memory problem ? desvages
2007-06-07 17:44 ` Jan Kiszka
2007-06-08 10:49   ` [Xenomai-help] measuring tasks execution time Daniel Simon
2007-06-08 11:20     ` [Xenomai-core] " Jan Kiszka
2007-06-08 13:09       ` Daniel Simon
2007-06-08 15:24         ` Jan Kiszka
2007-06-08 16:04           ` Jan Kiszka
2007-06-25 15:51       ` [Xenomai-core] " Daniel Simon
2007-06-25 16:55         ` Jan Kiszka
2007-06-27  8:57           ` Daniel Simon
2007-06-27 11:56             ` Jan Kiszka
2007-06-29 14:43               ` Daniel Simon
2007-06-29 15:00                 ` Jan Kiszka [this message]
2007-06-29 15:29                   ` Daniel Simon
2007-06-29 15:47                     ` Philippe Gerum
2007-06-29 15:56                       ` Gilles Chanteperdrix
2007-06-29 15:52                     ` Jan Kiszka
2007-07-08 10:11                 ` Jan Kiszka
2007-07-09  8:49                   ` Daniel Simon
2007-07-11 13:59                   ` Daniel Simon
2007-07-11 14:30                     ` Jan Kiszka
2007-07-11 15:35                       ` Daniel Simon
2007-07-11 15:56                         ` Jan Kiszka
2007-07-11 16:55                           ` Daniel Simon
2007-07-11 21:20                             ` Jan Kiszka
2007-07-12  9:30                               ` Daniel Simon
2007-07-12 11:02                                 ` Jan Kiszka
2007-07-16 16:19                                   ` Daniel Simon
     [not found]   ` <1753.194.254.210.7.1181246882.squirrel@domain.hid>
2007-06-08 15:19     ` [Xenomai-help] real time task disapears... memory problem ? Jan Kiszka
2007-06-09 16:06       ` desvages
2007-06-09 17:10         ` Jan Kiszka

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=46851E97.7030402@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=Daniel.Simon@domain.hid \
    --cc=xenomai@xenomai.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 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.