tsc_delta = sub64(tsc, *__tsc_ctr_switch);
+ if(kbill_ipc) {
+ kbill_ipc->p_kipc_cycles =
+ add64(kbill_ipc->p_kipc_cycles, tsc_delta);
+ kbill_ipc = NULL;
+ }
+
+ if(kbill_kcall) {
+ kbill_kcall->p_kcall_cycles =
+ add64(kbill_kcall->p_kcall_cycles, tsc_delta);
+ kbill_kcall = NULL;
+ }
+
/*
* deduct the just consumed cpu cycles from the cpu time left for this
* process during its current quantum. Skip IDLE and other pseudo kernel
EXTERN struct proc *vmrequest; /* first process on vmrequest queue */
EXTERN unsigned lost_ticks; /* clock ticks counted outside clock task */
EXTERN char *ipc_call_names[IPCNO_HIGHEST+1]; /* human-readable call names */
+EXTERN struct proc *kbill_kcall; /* process that made kernel call */
+EXTERN struct proc *kbill_ipc; /* process that invoked ipc */
/* Interrupt related variables. */
EXTERN irq_hook_t irq_hooks[NR_IRQ_HOOKS]; /* hooks for general use */
assert(!RTS_ISSET(caller_ptr, RTS_SLOT_FREE));
+ /* bill kernel time to this process. */
+ kbill_ipc = caller_ptr;
+
/* If this process is subject to system call tracing, handle that first. */
if (caller_ptr->p_misc_flags & (MF_SC_TRACE | MF_SC_DEFER)) {
/* Are we tracing this process, and is it the first sys_call entry? */
clock_t p_prof_left; /* number of ticks left on profile timer */
u64_t p_cycles; /* how many cycles did the process use */
+ u64_t p_kcall_cycles; /* kernel cycles caused by this proc (kcall) */
+ u64_t p_kipc_cycles; /* cycles caused by this proc (ipc) */
struct proc *p_nextready; /* pointer to next ready process */
struct proc *p_caller_q; /* head of list of procs wishing to send */
result = EBADREQUEST;
}
+
+ /* remember who invoked the kcall so we can bill it its time */
+ kbill_kcall = caller;
+
kernel_call_finish(caller, &msg, result);
}
make_zero64(rpc->p_cpu_time_left);
make_zero64(rpc->p_cycles);
+ make_zero64(rpc->p_kcall_cycles);
+ make_zero64(rpc->p_kipc_cycles);
/* If the parent is a privileged process, take away the privileges from the
* child process and inhibit it from running by setting the NO_PRIV flag.