diff options
author | David Höppner <0xffea@gmail.com> | 2013-01-04 22:43:53 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-01-13 20:13:32 +0100 |
commit | beda83efaa45fb04f142034f61eb1ae9fe872c59 (patch) | |
tree | b5e4a7a4b18e42feb24d46167028f8cf3130b557 /kern | |
parent | 392239d8c9979ac95c122b77d5d1e012f216d2ec (diff) |
Add statistics for task_events_info
* ipc/ipc_mqueue.c (ipc_mqueue_send, ipc_mqueue_receive): Increment
counters for message sent and received.
* kern/ipc_kobject.c (ipc_kobject_server): Increment sent and received
counters for the kernel task.
* kern/task.c (task_create): Zero statistics.
* kern/task.c (task_info): Add task_events_info call.
* kern/task.h: Add statistics.
* vm/vm_fault.c (vm_fault_page): Increment zero_fills, pageins,
reactivations and cow_faults counters.
* vm/vm_fault.c (vm_fault_wire_fast): Increment faults counters.
* vm/vm_pageout.c (vm_pageout_scan): Increment reactivations counter.
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) |