diff options
Diffstat (limited to 'kern')
-rw-r--r-- | kern/ipc_kobject.c | 10 | ||||
-rw-r--r-- | kern/task.c | 31 | ||||
-rw-r--r-- | kern/task.h | 9 |
3 files changed, 48 insertions, 2 deletions
diff --git a/kern/ipc_kobject.c b/kern/ipc_kobject.c index 5b35526..37d4eb9 100644 --- a/kern/ipc_kobject.c +++ b/kern/ipc_kobject.c @@ -177,15 +177,21 @@ ipc_kobject_server(request) #endif /* MACH_MACHINE_ROUTINES */ ) { (*routine)(&request->ikm_header, &reply->ikm_header); - } - else if (!ipc_kobject_notify(&request->ikm_header,&reply->ikm_header)){ + kernel_task->messages_received++; + } else { + if (!ipc_kobject_notify(&request->ikm_header, + &reply->ikm_header)) { ((mig_reply_header_t *) &reply->ikm_header)->RetCode = MIG_BAD_ID; #if MACH_IPC_TEST printf("ipc_kobject_server: bogus kernel message, id=%d\n", request->ikm_header.msgh_id); #endif /* MACH_IPC_TEST */ + } else { + kernel_task->messages_received++; + } } + kernel_task->messages_sent++; } check_simple_locks(); diff --git a/kern/task.c b/kern/task.c index 2624dd9..114dd31 100644 --- a/kern/task.c +++ b/kern/task.c @@ -108,6 +108,13 @@ kern_return_t task_create( new_task->active = TRUE; new_task->user_stop_count = 0; new_task->thread_count = 0; + new_task->faults = 0; + new_task->zero_fills = 0; + new_task->reactivations = 0; + new_task->pageins = 0; + new_task->cow_faults = 0; + new_task->messages_sent = 0; + new_task->messages_received = 0; eml_task_reference(new_task, parent_task); @@ -747,6 +754,30 @@ kern_return_t task_info( break; } + case TASK_EVENTS_INFO: + { + register task_events_info_t event_info; + + if (*task_info_count < TASK_EVENTS_INFO_COUNT) { + return KERN_INVALID_ARGUMENT; + } + + event_info = (task_events_info_t) task_info_out; + + task_lock(&task); + event_info->faults = task->faults; + event_info->zero_fills = task->zero_fills; + event_info->reactivations = task->reactivations; + event_info->pageins = task->pageins; + event_info->cow_faults = task->cow_faults; + event_info->messages_sent = task->messages_sent; + event_info->messages_received = task->messages_received; + task_unlock(&task); + + *task_info_count = TASK_EVENTS_INFO_COUNT; + break; + } + case TASK_THREAD_TIMES_INFO: { register task_thread_times_info_t times_info; diff --git a/kern/task.h b/kern/task.h index c425158..9bfea57 100644 --- a/kern/task.h +++ b/kern/task.h @@ -102,6 +102,15 @@ struct task { /* Hardware specific data. */ machine_task_t machine; + + /* Statistics */ + natural_t faults; /* page faults counter */ + natural_t zero_fills; /* zero fill pages counter */ + natural_t reactivations; /* reactivated pages counter */ + natural_t pageins; /* actual pageins couter */ + natural_t cow_faults; /* copy-on-write faults counter */ + natural_t messages_sent; /* messages sent counter */ + natural_t messages_received; /* messages received counter */ }; #define task_lock(task) simple_lock(&(task)->lock) |