Commit aacfaf8b authored by Jan Kiszka's avatar Jan Kiszka

cobalt: Avoid reading time twice via xnstat_exectime_update

This macro may unroll to instantiating 'date' twice. If that is a call
to some get-time function, as via xnstat_exectime_switch, we needlessly
do that twice.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 5f14ea8a
......@@ -44,9 +44,10 @@ typedef struct xnstat_exectime {
/* Accumulate exectime of the current account until the given date. */
#define xnstat_exectime_update(sched, date) \
do { \
xnticks_t __date = date; \
(sched)->current_account->total += \
date - (sched)->last_account_switch; \
(sched)->last_account_switch = date; \
__date - (sched)->last_account_switch; \
(sched)->last_account_switch = __date; \
/* All changes must be committed before changing the current_account \
reference in sched (required for xnintr_sync_stat_references) */ \
smp_wmb(); \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment