Module: xenomai-3
Branch: stable-3.0.x
Commit: 2367367985a4380259a3dc6f1c3cc53baea65cdb
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2367367985a4380259a3dc6f1c3cc53baea65cdb

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Jan 31 17:35:56 2016 +0100

cobalt/sched: fix timeout display in thread-related procfs information

A thread's periodic timer may be paced by a different clock than the
core clock; make sure to estimate the timeout value based on the
proper reference clock for such timer.

---

 kernel/cobalt/sched.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 0b7b93c..d8c594c 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -972,6 +972,7 @@ static int vfile_schedlist_next(struct 
xnvfile_snapshot_iterator *it,
        struct vfile_schedlist_data *p = data;
        xnticks_t timeout, period;
        struct xnthread *thread;
+       xnticks_t base_time;
 
        if (priv->curr == NULL)
                return 0;       /* All done. */
@@ -992,7 +993,10 @@ static int vfile_schedlist_next(struct 
xnvfile_snapshot_iterator *it,
        knamecpy(p->sched_class, thread->sched_class->name);
        knamecpy(p->personality, thread->personality->name);
        period = xnthread_get_period(thread);
-       timeout = xnthread_get_timeout(thread, priv->start_time);
+       base_time = priv->start_time;
+       if (xntimer_clock(&thread->ptimer) != &nkclock)
+               base_time = 
xnclock_read_monotonic(xntimer_clock(&thread->ptimer));
+       timeout = xnthread_get_timeout(thread, base_time);
        /*
         * Here we cheat: thread is periodic and the sampling rate may
         * be high, so it is indeed possible that the next tick date


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to