/* This relies on HAVE_UNSTABLE_SCHED_CLOCK. If it can't be defined, something similar logic should be implemented here. Xen sched_clock implementation. Returns the number of unstolen nanoseconds, which is nanoseconds the VCPU spent in RUNNING+BLOCKED states.  */
static unsigned long long xen_sched_clock(void)
/* This relies on HAVE_UNSTABLE_SCHED_CLOCK. If it can't be defined, something similar logic should be implemented here. Xen sched_clock implementation. Returns the number of unstolen nanoseconds, which is nanoseconds the VCPU spent in RUNNING+BLOCKED states.  */
static unsigned long long xen_sched_clock(void)
{
	struct vcpu_runstate_info runstate;
	unsigned long long now;
	unsigned long long offset;
	unsigned long long ret;
	preempt_disable();
	now = ia64_native_sched_clock();
	get_runstate_snapshot(&runstate);
	WARN_ON(runstate.state != RUNSTATE_running);
	offset = 0;
	if (now > runstate.state_entry_time)
		offset = now - runstate.state_entry_time;
	ret = runstate.time[RUNSTATE_blocked] +
		runstate.time[RUNSTATE_running] +
		offset;
	preempt_enable();
	return ret;
}