Meanwhile, "runtime" appears to me like the wrong term for what we provide with the xnstat API. Let's refactor every xnstat_exectime occurrence to xnstat_exectime (and a few more spots).
Jan
--- include/nucleus/intr.h | 6 ++-- include/nucleus/pod.h | 2 - include/nucleus/stat.h | 68 +++++++++++++++++++++++------------------------ include/nucleus/thread.h | 8 ++--- ksrc/nucleus/intr.c | 50 +++++++++++++++++----------------- ksrc/nucleus/module.c | 12 ++++---- ksrc/nucleus/pod.c | 10 +++--- ksrc/skins/native/task.c | 2 - 8 files changed, 79 insertions(+), 79 deletions(-) Index: xenomai/include/nucleus/intr.h =================================================================== --- xenomai.orig/include/nucleus/intr.h +++ xenomai/include/nucleus/intr.h @@ -64,8 +64,8 @@ typedef struct xnintr { const char *name; /* !< Symbolic name. */ struct { - xnstat_counter_t hits; /* !< Number of handled receipts since attachment. */ - xnstat_runtime_t account; /* !< Runtime accounting entity */ + xnstat_counter_t hits; /* !< Number of handled receipts since attachment. */ + xnstat_exectime_t account; /* !< Execution time accounting entity */ } stat[XNARCH_NR_CPUS]; } xnintr_t; @@ -110,7 +110,7 @@ xnarch_cpumask_t xnintr_affinity(xnintr_ xnarch_cpumask_t cpumask); int xnintr_query(int irq, int *cpu, xnintr_t **prev, int revision, char *name, - unsigned long *hits, xnticks_t *runtime, + unsigned long *hits, xnticks_t *exectime, xnticks_t *account_period); #ifdef __cplusplus Index: xenomai/include/nucleus/pod.h =================================================================== --- xenomai.orig/include/nucleus/pod.h +++ xenomai/include/nucleus/pod.h @@ -134,7 +134,7 @@ typedef struct xnsched { #ifdef CONFIG_XENO_OPT_STATS xnticks_t last_account_switch; /*!< Last account switch date (ticks). */ - xnstat_runtime_t *current_account; /*!< Currently active account */ + xnstat_exectime_t *current_account; /*!< Currently active account */ #endif /* CONFIG_XENO_OPT_STATS */ xntimer_t htimer; /*!< Host timer. */ Index: xenomai/include/nucleus/stat.h =================================================================== --- xenomai.orig/include/nucleus/stat.h +++ xenomai/include/nucleus/stat.h @@ -25,20 +25,20 @@ #include <nucleus/types.h> -typedef struct xnstat_runtime { +typedef struct xnstat_exectime { xnticks_t start; /* Start of execution time accumulation */ xnticks_t total; /* Accumulated execution time */ -} xnstat_runtime_t; +} xnstat_exectime_t; /* Return current date which can be passed to other xnstat services for immediate or lazy accounting. */ -#define xnstat_runtime_now() xnarch_get_cpu_tsc() +#define xnstat_exectime_now() xnarch_get_cpu_tsc() -/* Accumulate runtime of the current account until the given date. */ -#define xnstat_runtime_update(sched, date) \ +/* Accumulate exectime of the current account until the given date. */ +#define xnstat_exectime_update(sched, date) \ do { \ (sched)->current_account->total += \ date - (sched)->last_account_switch; \ @@ -49,34 +49,34 @@ do { \ } while (0) /* Update the current account reference, returning the previous one. */ -#define xnstat_runtime_set_current(sched, new_account) \ +#define xnstat_exectime_set_current(sched, new_account) \ ({ \ - xnstat_runtime_t *__prev; \ + xnstat_exectime_t *__prev; \ __prev = xnarch_atomic_xchg(&(sched)->current_account, (new_account)); \ __prev; \ }) /* Return the currently active accounting entity. */ -#define xnstat_runtime_get_current(sched) ((sched)->current_account) +#define xnstat_exectime_get_current(sched) ((sched)->current_account) -/* Finalize an account (no need to accumulate the runtime, just mark the +/* Finalize an account (no need to accumulate the exectime, just mark the switch date and set the new account). */ -#define xnstat_runtime_finalize(sched, new_account) \ +#define xnstat_exectime_finalize(sched, new_account) \ do { \ (sched)->last_account_switch = xnarch_get_cpu_tsc(); \ (sched)->current_account = (new_account); \ } while (0) -/* Obtain content of xnstat_runtime_t */ -#define xnstat_runtime_get_start(account) ((account)->start) -#define xnstat_runtime_get_total(account) ((account)->total) +/* Obtain content of xnstat_exectime_t */ +#define xnstat_exectime_get_start(account) ((account)->start) +#define xnstat_exectime_get_total(account) ((account)->total) /* Obtain last account switch date of considered sched */ -#define xnstat_runtime_get_last_switch(sched) ((sched)->last_account_switch) +#define xnstat_exectime_get_last_switch(sched) ((sched)->last_account_switch) /* Reset statistics from inside the accounted entity (e.g. after CPU migration). */ -#define xnstat_runtime_reset_stats(stat) \ +#define xnstat_exectime_reset_stats(stat) \ do { \ (stat)->total = 0; \ (stat)->start = xnarch_get_cpu_tsc(); \ @@ -103,21 +103,21 @@ static inline void xnstat_counter_set(xn } #else /* !CONFIG_XENO_OPT_STATS */ -typedef struct xnstat_runtime { +typedef struct xnstat_exectime { #ifdef __XENO_SIM__ int dummy; #endif /* __XENO_SIM__ */ -} xnstat_runtime_t; +} xnstat_exectime_t; -#define xnstat_runtime_now() ({ 0; }) -#define xnstat_runtime_update(sched, date) do { } while (0) -#define xnstat_runtime_set_current(sched, new_account) ({ (void)sched; NULL; }) -#define xnstat_runtime_get_current(sched) ({ (void)sched; NULL; }) -#define xnstat_runtime_finalize(sched, new_account) do { } while (0) -#define xnstat_runtime_get_start(account) ({ 0; }) -#define xnstat_runtime_get_total(account) ({ 0; }) -#define xnstat_runtime_get_last_switch(sched) ({ 0; }) -#define xnstat_runtime_reset_stats(account) do { } while (0) +#define xnstat_exectime_now() ({ 0; }) +#define xnstat_exectime_update(sched, date) do { } while (0) +#define xnstat_exectime_set_current(sched, new_account) ({ (void)sched; NULL; }) +#define xnstat_exectime_get_current(sched) ({ (void)sched; NULL; }) +#define xnstat_exectime_finalize(sched, new_account) do { } while (0) +#define xnstat_exectime_get_start(account) ({ 0; }) +#define xnstat_exectime_get_total(account) ({ 0; }) +#define xnstat_exectime_get_last_switch(sched) ({ 0; }) +#define xnstat_exectime_reset_stats(account) do { } while (0) typedef struct xnstat_counter { #ifdef __XENO_SIM__ @@ -130,20 +130,20 @@ typedef struct xnstat_counter { #define xnstat_counter_set(c, value) do { } while (0) #endif /* CONFIG_XENO_OPT_STATS */ -/* Account the runtime of the current account until now, switch to +/* Account the exectime of the current account until now, switch to new_account, and return the previous one. */ -#define xnstat_runtime_switch(sched, new_account) \ +#define xnstat_exectime_switch(sched, new_account) \ ({ \ - xnstat_runtime_update(sched, xnstat_runtime_now()); \ - xnstat_runtime_set_current(sched, new_account); \ + xnstat_exectime_update(sched, xnstat_exectime_now()); \ + xnstat_exectime_set_current(sched, new_account); \ }) -/* Account the runtime of the current account until given start time, switch +/* Account the exectime of the current account until given start time, switch to new_account, and return the previous one. */ -#define xnstat_runtime_lazy_switch(sched, new_account, date) \ +#define xnstat_exectime_lazy_switch(sched, new_account, date) \ ({ \ - xnstat_runtime_update(sched, date); \ - xnstat_runtime_set_current(sched, new_account); \ + xnstat_exectime_update(sched, date); \ + xnstat_exectime_set_current(sched, new_account); \ }) #endif /* !_XENO_NUCLEUS_STAT_H */ Index: xenomai/include/nucleus/thread.h =================================================================== --- xenomai.orig/include/nucleus/thread.h +++ xenomai/include/nucleus/thread.h @@ -205,8 +205,8 @@ typedef struct xnthread { xnstat_counter_t ssw; /* Primary -> secondary mode switch count */ xnstat_counter_t csw; /* Context switches (includes secondary -> primary switches) */ xnstat_counter_t pf; /* Number of page faults */ - xnstat_runtime_t account; /* Execution time accounting entity */ - xnstat_runtime_t lastperiod; /* Interval marker for execution time reports */ + xnstat_exectime_t account; /* Execution time accounting entity */ + xnstat_exectime_t lastperiod; /* Interval marker for execution time reports */ } stat; int errcode; /* Local errno */ @@ -293,8 +293,8 @@ typedef struct xnhook { 0 : xnarch_user_pid(xnthread_archtcb(thread))) #define xnthread_affinity(thread) ((thread)->affinity) #define xnthread_affine_p(thread, cpu) xnarch_cpu_isset(cpu, (thread)->affinity) -#define xnthread_get_exectime(thread) xnstat_runtime_get_total(&(thread)->stat.account) -#define xnthread_get_lastswitch(thread) xnstat_runtime_get_last_switch((thread)->sched) +#define xnthread_get_exectime(thread) xnstat_exectime_get_total(&(thread)->stat.account) +#define xnthread_get_lastswitch(thread) xnstat_exectime_get_last_switch((thread)->sched) /* Class-level operations for threads. */ static inline int xnthread_get_denormalized_prio(xnthread_t *t) Index: xenomai/ksrc/skins/native/task.c =================================================================== --- xenomai.orig/ksrc/skins/native/task.c +++ xenomai/ksrc/skins/native/task.c @@ -1147,7 +1147,7 @@ int rt_task_inquire(RT_TASK *task, RT_TA info->relpoint = xntimer_get_date(&task->thread_base.ptimer); raw_exectime = xnthread_get_exectime(&task->thread_base); if (task->thread_base.sched->runthread == &task->thread_base) - raw_exectime += xnstat_runtime_now() - + raw_exectime += xnstat_exectime_now() - xnthread_get_lastswitch(&task->thread_base); info->exectime = xnarch_tsc_to_ns(raw_exectime); info->modeswitches = xnstat_counter_get(&task->thread_base.stat.ssw); Index: xenomai/ksrc/nucleus/intr.c =================================================================== --- xenomai.orig/ksrc/nucleus/intr.c +++ xenomai/ksrc/nucleus/intr.c @@ -90,11 +90,11 @@ static void xnintr_irq_handler(unsigned void xnintr_clock_handler(void) { xnsched_t *sched = xnpod_current_sched(); - xnstat_runtime_t *prev; + xnstat_exectime_t *prev; xnticks_t start; - prev = xnstat_runtime_get_current(sched); - start = xnstat_runtime_now(); + prev = xnstat_exectime_get_current(sched); + start = xnstat_exectime_now(); xnarch_announce_tick(); @@ -109,7 +109,7 @@ void xnintr_clock_handler(void) xnlock_put(&nklock); xnstat_counter_inc(&nkclock.stat[xnsched_cpu(sched)].hits); - xnstat_runtime_lazy_switch(sched, + xnstat_exectime_lazy_switch(sched, &nkclock.stat[xnsched_cpu(sched)].account, start); if (--sched->inesting == 0 && xnsched_resched_p()) @@ -125,7 +125,7 @@ void xnintr_clock_handler(void) } xnltt_log_event(xeno_ev_iexit, XNARCH_TIMER_IRQ); - xnstat_runtime_switch(sched, prev); + xnstat_exectime_switch(sched, prev); } /* Optional support for shared interrupts. */ @@ -160,14 +160,14 @@ static inline xnintr_t *xnintr_shirq_nex static void xnintr_shirq_handler(unsigned irq, void *cookie) { xnsched_t *sched = xnpod_current_sched(); - xnstat_runtime_t *prev; + xnstat_exectime_t *prev; xnticks_t start; xnintr_irq_t *shirq = &xnirqs[irq]; xnintr_t *intr; int s = 0; - prev = xnstat_runtime_get_current(sched); - start = xnstat_runtime_now(); + prev = xnstat_exectime_get_current(sched); + start = xnstat_exectime_now(); xnltt_log_event(xeno_ev_ienter, irq); ++sched->inesting; @@ -184,10 +184,10 @@ static void xnintr_shirq_handler(unsigne if (ret & XN_ISR_HANDLED) { xnstat_counter_inc( &intr->stat[xnsched_cpu(sched)].hits); - xnstat_runtime_lazy_switch(sched, + xnstat_exectime_lazy_switch(sched, &intr->stat[xnsched_cpu(sched)].account, start); - start = xnstat_runtime_now(); + start = xnstat_exectime_now(); } intr = intr->next; @@ -213,7 +213,7 @@ static void xnintr_shirq_handler(unsigne xnpod_schedule(); xnltt_log_event(xeno_ev_iexit, irq); - xnstat_runtime_switch(sched, prev); + xnstat_exectime_switch(sched, prev); } /* @@ -225,14 +225,14 @@ static void xnintr_edge_shirq_handler(un const int MAX_EDGEIRQ_COUNTER = 128; xnsched_t *sched = xnpod_current_sched(); - xnstat_runtime_t *prev; + xnstat_exectime_t *prev; xnticks_t start; xnintr_irq_t *shirq = &xnirqs[irq]; xnintr_t *intr, *end = NULL; int s = 0, counter = 0; - prev = xnstat_runtime_get_current(sched); - start = xnstat_runtime_now(); + prev = xnstat_exectime_get_current(sched); + start = xnstat_exectime_now(); xnltt_log_event(xeno_ev_ienter, irq); ++sched->inesting; @@ -243,7 +243,7 @@ static void xnintr_edge_shirq_handler(un while (intr != end) { int ret, code; - xnstat_runtime_switch(sched, + xnstat_exectime_switch(sched, &intr->stat[xnsched_cpu(sched)].account); ret = intr->isr(intr); @@ -255,10 +255,10 @@ static void xnintr_edge_shirq_handler(un end = shirq->handlers; xnstat_counter_inc( &intr->stat[xnsched_cpu(sched)].hits); - xnstat_runtime_lazy_switch(sched, + xnstat_exectime_lazy_switch(sched, &intr->stat[xnsched_cpu(sched)].account, start); - start = xnstat_runtime_now(); + start = xnstat_exectime_now(); } if (counter++ > MAX_EDGEIRQ_COUNTER) @@ -293,7 +293,7 @@ static void xnintr_edge_shirq_handler(un xnpod_schedule(); xnltt_log_event(xeno_ev_iexit, irq); - xnstat_runtime_switch(sched, prev); + xnstat_exectime_switch(sched, prev); } static inline int xnintr_irq_attach(xnintr_t *intr) @@ -437,12 +437,12 @@ static void xnintr_irq_handler(unsigned { xnsched_t *sched = xnpod_current_sched(); xnintr_t *intr; - xnstat_runtime_t *prev; + xnstat_exectime_t *prev; xnticks_t start; int s; - prev = xnstat_runtime_get_current(sched); - start = xnstat_runtime_now(); + prev = xnstat_exectime_get_current(sched); + start = xnstat_exectime_now(); xnltt_log_event(xeno_ev_ienter, irq); ++sched->inesting; @@ -471,7 +471,7 @@ static void xnintr_irq_handler(unsigned } } else { xnstat_counter_inc(&intr->stat[xnsched_cpu(sched)].hits); - xnstat_runtime_lazy_switch(sched, + xnstat_exectime_lazy_switch(sched, &intr->stat[xnsched_cpu(sched)].account, start); intr->unhandled = 0; @@ -491,7 +491,7 @@ static void xnintr_irq_handler(unsigned xnpod_schedule(); xnltt_log_event(xeno_ev_iexit, irq); - xnstat_runtime_switch(sched, prev); + xnstat_exectime_switch(sched, prev); } int xnintr_mount(void) @@ -884,7 +884,7 @@ int xnintr_irq_proc(unsigned int irq, ch #ifdef CONFIG_XENO_OPT_STATS int xnintr_query(int irq, int *cpu, xnintr_t **prev, int revision, char *name, - unsigned long *hits, xnticks_t *runtime, + unsigned long *hits, xnticks_t *exectime, xnticks_t *account_period) { xnintr_t *intr; @@ -922,7 +922,7 @@ int xnintr_query(int irq, int *cpu, xnin last_switch = xnpod_sched_slot(cpu_no)->last_account_switch; - *runtime = intr->stat[cpu_no].account.total; + *exectime = intr->stat[cpu_no].account.total; *account_period = last_switch - intr->stat[cpu_no].account.start; intr->stat[cpu_no].account.total = 0; Index: xenomai/ksrc/nucleus/module.c =================================================================== --- xenomai.orig/ksrc/nucleus/module.c +++ xenomai/ksrc/nucleus/module.c @@ -272,7 +272,7 @@ struct stat_seq_iterator { unsigned long ssw; unsigned long csw; unsigned long pf; - xnticks_t runtime; + xnticks_t exectime; xnticks_t account_period; } stat_info[1]; }; @@ -319,11 +319,11 @@ static int stat_seq_show(struct seq_file if (p->account_period) { while (p->account_period > 0xFFFFFFFF) { - p->runtime >>= 16; + p->exectime >>= 16; p->account_period >>= 16; } usage = - xnarch_ulldiv(p->runtime * 1000LL + + xnarch_ulldiv(p->exectime * 1000LL + (p->account_period >> 1), p->account_period, NULL); } @@ -423,10 +423,10 @@ static int stat_seq_open(struct inode *i period = sched->last_account_switch - thread->stat.lastperiod.start; if (!period && thread == sched->runthread) { - stat_info->runtime = 1; + stat_info->exectime = 1; stat_info->account_period = 1; } else { - stat_info->runtime = thread->stat.account.total - + stat_info->exectime = thread->stat.account.total - thread->stat.lastperiod.total; stat_info->account_period = period; } @@ -452,7 +452,7 @@ static int stat_seq_open(struct inode *i err = xnintr_query(irq, &cpu, &prev, intr_rev, stat_info->name, &stat_info->csw, - &stat_info->runtime, + &stat_info->exectime, &stat_info->account_period); if (err == -EAGAIN) goto restart_unlocked; Index: xenomai/ksrc/nucleus/pod.c =================================================================== --- xenomai.orig/ksrc/nucleus/pod.c +++ xenomai/ksrc/nucleus/pod.c @@ -407,7 +407,7 @@ int xnpod_init(void) sched->rootcb.affinity = xnarch_cpumask_of_cpu(cpu); - xnstat_runtime_set_current(sched, &sched->rootcb.stat.account); + xnstat_exectime_set_current(sched, &sched->rootcb.stat.account); } xnarch_hook_ipi(&xnpod_schedule_handler); @@ -572,7 +572,7 @@ static inline void xnpod_switch_zombie(x xnthread_cleanup_tcb(threadout); - xnstat_runtime_finalize(sched, &threadin->stat.account); + xnstat_exectime_finalize(sched, &threadin->stat.account); xnarch_finalize_and_switch(xnthread_archtcb(threadout), xnthread_archtcb(threadin)); @@ -1782,7 +1782,7 @@ int xnpod_migrate_thread(int cpu) /* Reset execution time measurement period so that we don't mess up per-CPU statistics. */ - xnstat_runtime_reset_stats(&thread->stat.lastperiod); + xnstat_exectime_reset_stats(&thread->stat.lastperiod); unlock_and_exit: @@ -2376,7 +2376,7 @@ void xnpod_schedule(void) xnarch_enter_root(xnthread_archtcb(threadin)); } - xnstat_runtime_switch(sched, &threadin->stat.account); + xnstat_exectime_switch(sched, &threadin->stat.account); xnstat_counter_inc(&threadin->stat.csw); xnarch_switch_to(xnthread_archtcb(threadout), @@ -2551,7 +2551,7 @@ void xnpod_schedule_runnable(xnthread_t nkpod->schedhook(runthread, XNREADY); #endif /* __XENO_SIM__ */ - xnstat_runtime_switch(sched, &threadin->stat.account); + xnstat_exectime_switch(sched, &threadin->stat.account); xnstat_counter_inc(&threadin->stat.csw); xnarch_switch_to(xnthread_archtcb(runthread),
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core