Skip to contentSkip to conversation

Refactor xnstat_runtime to xnstat_exectime

PATCH New Jan Kiszka 1 participant 1 message Jul 12, 2007

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 2/3 Refactor xnstat_runtime to xnstat_exectime

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(-)
include/nucleus/intr.h +3 -3
Index: 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
include/nucleus/pod.h +1 -1
Index: 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. */
include/nucleus/stat.h +34 -34

129 lines not on this page · raw message

include/nucleus/thread.h +4 -4
Index: 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)
ksrc/skins/native/task.c +1 -1
Index: 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);
ksrc/nucleus/intr.c +25 -25

159 lines not on this page · raw message

ksrc/nucleus/module.c +6 -6
Index: 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;
ksrc/nucleus/pod.c +5 -5
Index: 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),