Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset a307beb in mainline


Ignore:
Timestamp:
2010-04-14T14:41:54Z (12 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master
Children:
bdfd3c97
Parents:
e43cdac
Message:

IPC statistics measured.

Location:
kernel/generic
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/proc/task.h

    re43cdac ra307beb  
    9494        answerbox_t answerbox;  /**< Communication endpoint */
    9595        phone_t phones[IPC_MAX_PHONES];
     96        task_ipc_info_t ipc_info; /**< IPC statistics */
    9697        /**
    9798         * Active asynchronous messages. It is used for limiting uspace to
  • kernel/generic/include/ps/taskinfo.h

    re43cdac ra307beb  
    4646
    4747typedef struct {
     48        uint64_t call_sent;
     49        uint64_t call_recieved;
     50        uint64_t answer_sent;
     51        uint64_t answer_recieved;
     52        uint64_t irq_notif_recieved;
     53        uint64_t forwarded;
     54} task_ipc_info_t;
     55
     56typedef struct {
    4857        task_id_t taskid;
    4958        char name[TASK_NAME_BUFLEN];
     
    5261        uint64_t ucycles;
    5362        uint64_t kcycles;
     63        task_ipc_info_t ipc_info;
    5464} task_info_t;
    5565
  • kernel/generic/src/ipc/ipc.c

    re43cdac ra307beb  
    219219        bool do_lock = ((!selflocked) || callerbox != (&TASK->answerbox));
    220220
     221        spinlock_lock(&TASK->lock);
     222        TASK->ipc_info.answer_sent++;
     223        spinlock_unlock(&TASK->lock);
     224
    221225        call->flags |= IPC_CALL_ANSWERED;
    222226
     
    276280static void _ipc_call(phone_t *phone, answerbox_t *box, call_t *call)
    277281{
     282        spinlock_lock(&TASK->lock);
     283        TASK->ipc_info.call_sent++;
     284        spinlock_unlock(&TASK->lock);
     285
    278286        if (!(call->flags & IPC_CALL_FORWARDED)) {
    279287                atomic_inc(&phone->active_calls);
     
    376384int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox, int mode)
    377385{
     386        spinlock_lock(&TASK->lock);
     387        TASK->ipc_info.forwarded++;
     388        spinlock_unlock(&TASK->lock);
     389
    378390        spinlock_lock(&oldbox->lock);
    379391        list_remove(&call->link);
     
    416428        spinlock_lock(&box->lock);
    417429        if (!list_empty(&box->irq_notifs)) {
     430
     431                spinlock_lock(&TASK->lock);
     432                TASK->ipc_info.irq_notif_recieved++;
     433                spinlock_unlock(&TASK->lock);
     434
    418435                ipl = interrupts_disable();
    419436                spinlock_lock(&box->irq_lock);
     
    425442                interrupts_restore(ipl);
    426443        } else if (!list_empty(&box->answers)) {
     444                spinlock_lock(&TASK->lock);
     445                TASK->ipc_info.answer_recieved++;
     446                spinlock_unlock(&TASK->lock);
     447
    427448                /* Handle asynchronous answers */
    428449                request = list_get_instance(box->answers.next, call_t, link);
     
    430451                atomic_dec(&request->data.phone->active_calls);
    431452        } else if (!list_empty(&box->calls)) {
     453
     454                spinlock_lock(&TASK->lock);
     455                TASK->ipc_info.call_recieved++;
     456                spinlock_unlock(&TASK->lock);
     457
    432458                /* Handle requests */
    433459                request = list_get_instance(box->calls.next, call_t, link);
  • kernel/generic/src/proc/task.c

    re43cdac ra307beb  
    187187        ta->kcycles = 0;
    188188
     189        ta->ipc_info.call_sent = 0;
     190        ta->ipc_info.call_recieved = 0;
     191        ta->ipc_info.answer_sent = 0;
     192        ta->ipc_info.answer_recieved = 0;
     193        ta->ipc_info.irq_notif_recieved = 0;
     194        ta->ipc_info.forwarded = 0;
     195
    189196#ifdef CONFIG_UDEBUG
    190197        /* Init debugging stuff */
  • kernel/generic/src/ps/ps.c

    re43cdac ra307beb  
    143143        copy_to_uspace(&uspace_info->kcycles, &kcycles, sizeof(uint64_t));
    144144
     145        task_ipc_info_t ipc_info;
     146        ipc_info.call_sent = t->ipc_info.call_sent;
     147        ipc_info.call_recieved = t->ipc_info.call_recieved;
     148        ipc_info.answer_sent = t->ipc_info.answer_sent;
     149        ipc_info.answer_recieved = t->ipc_info.answer_recieved;
     150        ipc_info.irq_notif_recieved = t->ipc_info.irq_notif_recieved;
     151        ipc_info.forwarded = t->ipc_info.forwarded;
     152        copy_to_uspace(&uspace_info->ipc_info, &ipc_info, sizeof(task_ipc_info_t));
     153
    145154        uint64_t memory = get_task_memory(t->as);
    146155        copy_to_uspace(&uspace_info->virt_mem, &memory, sizeof(memory));
Note: See TracChangeset for help on using the changeset viewer.