asmvolatile( " stpt %0\n"/* Store current cpu timer value */ " spt %1"/* Set new value imm. afterwards */
: "=Q" (timer) : "Q" (expires));
lc->system_timer += lc->last_update_timer - timer;
lc->last_update_timer = expires;
}
/* * Update process times based on virtual cpu times stored by entry.S * to the lowcore fields user_timer, system_timer & steal_clock.
*/ staticint do_account_vtime(struct task_struct *tsk)
{
u64 timer, clock, user, guest, system, hardirq, softirq; struct lowcore *lc = get_lowcore();
timer = lc->last_update_timer;
clock = lc->last_update_clock; asmvolatile( " stpt %0\n"/* Store current cpu timer value */ " stckf %1"/* Store current tod clock value */
: "=Q" (lc->last_update_timer), "=Q" (lc->last_update_clock)
: : "cc");
clock = lc->last_update_clock - clock;
timer -= lc->last_update_timer;
if (hardirq_count())
lc->hardirq_timer += timer; else
lc->system_timer += timer;
/* Calculate cputime delta */
user = update_tsk_timer(&tsk->thread.user_timer,
READ_ONCE(lc->user_timer));
guest = update_tsk_timer(&tsk->thread.guest_timer,
READ_ONCE(lc->guest_timer));
system = update_tsk_timer(&tsk->thread.system_timer,
READ_ONCE(lc->system_timer));
hardirq = update_tsk_timer(&tsk->thread.hardirq_timer,
READ_ONCE(lc->hardirq_timer));
softirq = update_tsk_timer(&tsk->thread.softirq_timer,
READ_ONCE(lc->softirq_timer));
lc->steal_timer +=
clock - user - guest - system - hardirq - softirq;
/* Push account value */ if (user) {
account_user_time(tsk, cputime_to_nsecs(user));
tsk->utimescaled += cputime_to_nsecs(scale_vtime(user));
}
if (guest) {
account_guest_time(tsk, cputime_to_nsecs(guest));
tsk->utimescaled += cputime_to_nsecs(scale_vtime(guest));
}
if (system)
account_system_index_scaled(tsk, system, CPUTIME_SYSTEM); if (hardirq)
account_system_index_scaled(tsk, hardirq, CPUTIME_IRQ); if (softirq)
account_system_index_scaled(tsk, softirq, CPUTIME_SOFTIRQ);
/* * In s390, accounting pending user time also implies * accounting system time in order to correctly compute * the stolen time accounting.
*/ void vtime_flush(struct task_struct *tsk)
{ struct lowcore *lc = get_lowcore();
u64 steal, avg_steal;
/* * Update process times based on virtual cpu times stored by entry.S * to the lowcore fields user_timer, system_timer & steal_clock.
*/ void vtime_account_kernel(struct task_struct *tsk)
{ struct lowcore *lc = get_lowcore();
u64 delta = vtime_delta();
/* * Sorted add to a list. List is linear searched until first bigger * element is found.
*/ staticvoid list_add_sorted(struct vtimer_list *timer, struct list_head *head)
{ struct vtimer_list *tmp;
staticvoid internal_add_vtimer(struct vtimer_list *timer)
{ if (list_empty(&virt_timer_list)) { /* First timer, just program it. */
atomic64_set(&virt_timer_current, timer->expires);
atomic64_set(&virt_timer_elapsed, 0);
list_add(&timer->entry, &virt_timer_list);
} else { /* Update timer against current base. */
timer->expires += atomic64_read(&virt_timer_elapsed); if (likely((s64) timer->expires <
(s64) atomic64_read(&virt_timer_current))) /* The new timer expires before the current timer. */
atomic64_set(&virt_timer_current, timer->expires); /* Insert new timer into the list. */
list_add_sorted(timer, &virt_timer_list);
}
}
staticvoid __add_vtimer(struct vtimer_list *timer, int periodic)
{ unsignedlong flags;
/* * returns whether it has modified a pending timer (1) or not (0)
*/ int mod_virt_timer(struct vtimer_list *timer, u64 expires)
{ return __mod_vtimer(timer, expires, 0);
}
EXPORT_SYMBOL(mod_virt_timer);
/* * returns whether it has modified a pending timer (1) or not (0)
*/ int mod_virt_timer_periodic(struct vtimer_list *timer, u64 expires)
{ return __mod_vtimer(timer, expires, 1);
}
EXPORT_SYMBOL(mod_virt_timer_periodic);
/* * Delete a virtual timer. * * returns whether the deleted timer was pending (1) or not (0)
*/ int del_virt_timer(struct vtimer_list *timer)
{ unsignedlong flags;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.