@@ -1643,6 +1643,16 @@ void tacc_irq_exit(int place)
tacc->irq_cnt--;
}
+s_time_t tacc_get_guest_time(struct tacc *tacc)
+{
+ s_time_t guest_time;
+
+ guest_time = tacc->state_time[TACC_GUEST];
+ guest_time += tacc->state_time[TACC_GSYNC];
+
+ return guest_time;
+}
+
void context_saved(struct vcpu *prev)
{
/* Clear running flag /after/ writing context to memory. */
@@ -266,6 +266,8 @@ struct vcpu
struct evtchn_fifo_vcpu *evtchn_fifo;
+ s_time_t pcpu_guest_time;
+
/* vPCI per-vCPU area, used to store data for long running operations. */
struct vpci_vcpu vpci;
@@ -1033,6 +1035,12 @@ DECLARE_PER_CPU(struct tacc, tacc);
void tacc_hyp(int place);
void tacc_idle(int place);
+s_time_t tacc_get_guest_time(struct tacc *tacc);
+inline s_time_t tacc_get_guest_time_delta(void)
+{
+ return tacc_get_guest_time(&this_cpu(tacc)) - current->pcpu_guest_time;
+}
+
#endif /* __SCHED_H__ */
/*