Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ipc.c

    rc713aa56 r170332d  
    218218        answerbox_t *callerbox = call->callerbox;
    219219        bool do_lock = ((!selflocked) || callerbox != (&TASK->answerbox));
     220        ipl_t ipl;
     221
     222        /* Count sent answer */
     223        ipl = interrupts_disable();
     224        spinlock_lock(&TASK->lock);
     225        TASK->ipc_info.answer_sent++;
     226        spinlock_unlock(&TASK->lock);
     227        interrupts_restore(ipl);
    220228
    221229        call->flags |= IPC_CALL_ANSWERED;
     
    276284static void _ipc_call(phone_t *phone, answerbox_t *box, call_t *call)
    277285{
     286        ipl_t ipl;
     287
     288        /* Count sent ipc call */
     289        ipl = interrupts_disable();
     290        spinlock_lock(&TASK->lock);
     291        TASK->ipc_info.call_sent++;
     292        spinlock_unlock(&TASK->lock);
     293        interrupts_restore(ipl);
     294
    278295        if (!(call->flags & IPC_CALL_FORWARDED)) {
    279296                atomic_inc(&phone->active_calls);
     
    376393int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox, int mode)
    377394{
     395        ipl_t ipl;
     396
     397        /* Count forwarded calls */
     398        ipl = interrupts_disable();
     399        spinlock_lock(&TASK->lock);
     400        TASK->ipc_info.forwarded++;
     401        spinlock_unlock(&TASK->lock);
     402        interrupts_restore(ipl);
     403
    378404        spinlock_lock(&oldbox->lock);
    379405        list_remove(&call->link);
     
    407433        call_t *request;
    408434        ipl_t ipl;
     435        uint64_t irq_cnt = 0;
     436        uint64_t answer_cnt = 0;
     437        uint64_t call_cnt = 0;
    409438        int rc;
    410439
     
    416445        spinlock_lock(&box->lock);
    417446        if (!list_empty(&box->irq_notifs)) {
     447                /* Count recieved IRQ notification */
     448                irq_cnt++;     
     449
    418450                ipl = interrupts_disable();
    419451                spinlock_lock(&box->irq_lock);
     
    425457                interrupts_restore(ipl);
    426458        } else if (!list_empty(&box->answers)) {
     459                /* Count recieved answer */
     460                answer_cnt++;
     461
    427462                /* Handle asynchronous answers */
    428463                request = list_get_instance(box->answers.next, call_t, link);
     
    430465                atomic_dec(&request->data.phone->active_calls);
    431466        } else if (!list_empty(&box->calls)) {
     467                /* Count recieved call */
     468                call_cnt++;
     469
    432470                /* Handle requests */
    433471                request = list_get_instance(box->calls.next, call_t, link);
     
    441479        }
    442480        spinlock_unlock(&box->lock);
     481       
     482        ipl = interrupts_disable();
     483        spinlock_lock(&TASK->lock);
     484        TASK->ipc_info.irq_notif_recieved += irq_cnt;
     485        TASK->ipc_info.answer_recieved += answer_cnt;
     486        TASK->ipc_info.call_recieved += call_cnt;
     487        spinlock_unlock(&TASK->lock);
     488        interrupts_restore(ipl);
     489
    443490        return request;
    444491}
     
    644691        call_t *call;
    645692        link_t *tmp;
     693        ipl_t ipl;
    646694       
     695        ipl = interrupts_disable();
    647696        spinlock_lock(&tasks_lock);
    648697        task = task_find_by_id(taskid);
     
    650699                spinlock_lock(&task->lock);
    651700        spinlock_unlock(&tasks_lock);
    652         if (!task)
     701        if (!task) {
     702                interrupts_restore(ipl);
    653703                return;
     704        }
    654705
    655706        /* Print opened phones & details */
     
    734785        spinlock_unlock(&task->answerbox.lock);
    735786        spinlock_unlock(&task->lock);
     787        interrupts_restore(ipl);
    736788}
    737789
Note: See TracChangeset for help on using the changeset viewer.