Changeset f579760 in mainline for kernel/generic/src


Ignore:
Timestamp:
2011-01-27T19:39:54Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ae0300b5
Parents:
875c629 (diff), caa8a94 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
  • merge "tasks" and "stats" tools into one binary
  • improve the printouts of various tools and kernel console commands
Location:
kernel/generic/src
Files:
3 edited

Legend:

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

    r875c629 rf579760  
    690690        irq_spinlock_exchange(&tasks_lock, &task->lock);
    691691       
    692         /* Print opened phones & details */
    693         printf("PHONE:\n");
     692        printf("[phone id] [calls] [state\n");
    694693       
    695694        size_t i;
    696695        for (i = 0; i < IPC_MAX_PHONES; i++) {
    697696                if (SYNCH_FAILED(mutex_trylock(&task->phones[i].lock))) {
    698                         printf("%zu: mutex busy\n", i);
     697                        printf("%-10zu (mutex busy)\n", i);
    699698                        continue;
    700699                }
    701700               
    702701                if (task->phones[i].state != IPC_PHONE_FREE) {
    703                         printf("%zu: ", i);
     702                        printf("%-10zu %7" PRIun " ", i,
     703                            atomic_get(&task->phones[i].active_calls));
    704704                       
    705705                        switch (task->phones[i].state) {
    706706                        case IPC_PHONE_CONNECTING:
    707                                 printf("connecting ");
     707                                printf("connecting");
    708708                                break;
    709709                        case IPC_PHONE_CONNECTED:
    710                                 printf("connected to: %p (%" PRIu64 ") ",
    711                                     task->phones[i].callee,
    712                                     task->phones[i].callee->task->taskid);
     710                                printf("connected to %" PRIu64 " (%s)",
     711                                    task->phones[i].callee->task->taskid,
     712                                    task->phones[i].callee->task->name);
    713713                                break;
    714714                        case IPC_PHONE_SLAMMED:
    715                                 printf("slammed by: %p ",
     715                                printf("slammed by %p",
    716716                                    task->phones[i].callee);
    717717                                break;
    718718                        case IPC_PHONE_HUNGUP:
    719                                 printf("hung up - was: %p ",
     719                                printf("hung up by %p",
    720720                                    task->phones[i].callee);
    721721                                break;
     
    724724                        }
    725725                       
    726                         printf("active: %" PRIun "\n",
    727                             atomic_get(&task->phones[i].active_calls));
     726                        printf("\n");
    728727                }
    729728               
     
    733732        irq_spinlock_lock(&task->answerbox.lock, false);
    734733       
     734#ifdef __32_BITS__
     735        printf("[call id ] [method] [arg1] [arg2] [arg3] [arg4] [arg5]"
     736            " [flags] [sender\n");
     737#endif
     738       
     739#ifdef __64_BITS__
     740        printf("[call id         ] [method] [arg1] [arg2] [arg3] [arg4]"
     741            " [arg5] [flags] [sender\n");
     742#endif
     743       
    735744        link_t *cur;
    736745       
    737         /* Print answerbox - calls */
    738         printf("ABOX - CALLS:\n");
     746        printf(" --- incomming calls ---\n");
    739747        for (cur = task->answerbox.calls.next; cur != &task->answerbox.calls;
    740748            cur = cur->next) {
    741749                call_t *call = list_get_instance(cur, call_t, link);
    742                 printf("Callid: %p Srctask:%" PRIu64 " M:%" PRIun
    743                     " A1:%" PRIun " A2:%" PRIun " A3:%" PRIun
    744                     " A4:%" PRIun " A5:%" PRIun " Flags:%x\n", call,
    745                     call->sender->taskid,
     750               
     751#ifdef __32_BITS__
     752                printf("%10p ", call);
     753#endif
     754               
     755#ifdef __64_BITS__
     756                printf("%18p ", call);
     757#endif
     758               
     759                printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
     760                    " %-6" PRIun " %-6" PRIun " %-7x %" PRIu64 " (%s)\n",
    746761                    IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
    747762                    IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
    748763                    IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
    749                     call->flags);
    750         }
    751        
    752         /* Print answerbox - dispatched calls */
    753         printf("ABOX - DISPATCHED CALLS:\n");
     764                    call->flags, call->sender->taskid, call->sender->name);
     765        }
     766       
     767        printf(" --- dispatched calls ---\n");
    754768        for (cur = task->answerbox.dispatched_calls.next;
    755769            cur != &task->answerbox.dispatched_calls;
    756770            cur = cur->next) {
    757771                call_t *call = list_get_instance(cur, call_t, link);
    758                 printf("Callid: %p Srctask:%" PRIu64 " M:%" PRIun
    759                     " A1:%" PRIun " A2:%" PRIun " A3:%" PRIun
    760                     " A4:%" PRIun " A5:%" PRIun " Flags:%x\n", call,
    761                     call->sender->taskid,
     772               
     773#ifdef __32_BITS__
     774                printf("%10p ", call);
     775#endif
     776               
     777#ifdef __64_BITS__
     778                printf("%18p ", call);
     779#endif
     780               
     781                printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
     782                    " %-6" PRIun " %-6" PRIun " %-7x %" PRIu64 " (%s)\n",
    762783                    IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
    763784                    IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
    764785                    IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
    765                     call->flags);
    766         }
    767        
    768         /* Print answerbox - answers */
    769         printf("ABOX - ANSWERS:\n");
     786                    call->flags, call->sender->taskid, call->sender->name);
     787        }
     788       
     789        printf(" --- outgoing answers ---\n");
    770790        for (cur = task->answerbox.answers.next;
    771791            cur != &task->answerbox.answers;
    772792            cur = cur->next) {
    773793                call_t *call = list_get_instance(cur, call_t, link);
    774                 printf("Callid:%p M:%" PRIun " A1:%" PRIun " A2:%" PRIun
    775                     " A3:%" PRIun " A4:%" PRIun " A5:%" PRIun " Flags:%x\n",
    776                     call, IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
     794               
     795#ifdef __32_BITS__
     796                printf("%10p ", call);
     797#endif
     798               
     799#ifdef __64_BITS__
     800                printf("%18p ", call);
     801#endif
     802               
     803                printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
     804                    " %-6" PRIun " %-6" PRIun " %-7x %" PRIu64 " (%s)\n",
     805                    IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
    777806                    IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
    778807                    IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
    779                     call->flags);
     808                    call->flags, call->sender->taskid, call->sender->name);
    780809        }
    781810       
  • kernel/generic/src/proc/task.c

    r875c629 rf579760  
    342342sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len)
    343343{
    344         int rc;
    345344        char namebuf[TASK_NAME_BUFLEN];
    346345       
    347346        /* Cap length of name and copy it from userspace. */
    348        
    349347        if (name_len > TASK_NAME_BUFLEN - 1)
    350348                name_len = TASK_NAME_BUFLEN - 1;
    351349       
    352         rc = copy_from_uspace(namebuf, uspace_name, name_len);
     350        int rc = copy_from_uspace(namebuf, uspace_name, name_len);
    353351        if (rc != 0)
    354352                return (sysarg_t) rc;
    355353       
    356354        namebuf[name_len] = '\0';
     355       
     356        /*
     357         * As the task name is referenced also from the
     358         * threads, lock the threads' lock for the course
     359         * of the update.
     360         */
     361       
     362        irq_spinlock_lock(&tasks_lock, true);
     363        irq_spinlock_lock(&TASK->lock, false);
     364        irq_spinlock_lock(&threads_lock, false);
     365       
     366        /* Set task name */
    357367        str_cpy(TASK->name, TASK_NAME_BUFLEN, namebuf);
     368       
     369        irq_spinlock_unlock(&threads_lock, false);
     370        irq_spinlock_unlock(&TASK->lock, false);
     371        irq_spinlock_unlock(&tasks_lock, true);
    358372       
    359373        return EOK;
  • kernel/generic/src/proc/thread.c

    r875c629 rf579760  
    591591        order_suffix(thread->kcycles, &kcycles, &ksuffix);
    592592       
     593        char *name;
     594        if (str_cmp(thread->name, "uinit") == 0)
     595                name = thread->task->name;
     596        else
     597                name = thread->name;
     598       
    593599#ifdef __32_BITS__
    594600        if (*additional)
    595                 printf("%-8" PRIu64" %10p %9" PRIu64 "%c %9" PRIu64 "%c ",
    596                     thread->tid, thread->kstack, ucycles, usuffix,
    597                     kcycles, ksuffix);
     601                printf("%-8 %10p" PRIu64" %10p %9" PRIu64 "%c %9" PRIu64 "%c ",
     602                    thread->tid, thread->thread_code, thread->kstack,
     603                    ucycles, usuffix, kcycles, ksuffix);
    598604        else
    599                 printf("%-8" PRIu64" %-14s %10p %-8s %10p %-5" PRIu32 " %10p\n",
    600                     thread->tid, thread->name, thread, thread_states[thread->state],
     605                printf("%-8" PRIu64" %-14s %10p %-8s %10p %-5" PRIu32 "\n",
     606                    thread->tid, name, thread, thread_states[thread->state],
    601607                    thread->task, thread->task->context, thread->thread_code);
    602608#endif
     
    610616        else
    611617                printf("%-8" PRIu64" %-14s %18p %-8s %18p %-5" PRIu32 "\n",
    612                     thread->tid, thread->name, thread, thread_states[thread->state],
     618                    thread->tid, name, thread, thread_states[thread->state],
    613619                    thread->task, thread->task->context);
    614620#endif
     
    648654#ifdef __32_BITS__
    649655        if (additional)
    650                 printf("[id    ] [stack   ] [ucycles ] [kcycles ] [cpu]"
    651                     " [waitqueue]\n");
     656                printf("[id    ] [code    ] [stack   ] [ucycles ] [kcycles ]"
     657                    " [cpu] [waitqueue]\n");
    652658        else
    653659                printf("[id    ] [name        ] [address ] [state ] [task    ]"
    654                     " [ctx] [code    ]\n");
     660                    " [ctx]\n");
    655661#endif
    656662       
Note: See TracChangeset for help on using the changeset viewer.