Changeset c0f13d2 in mainline
- Timestamp:
- 2010-06-10T16:04:07Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 48dcc69
- Parents:
- 8eec3c8
- Location:
- kernel/generic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/console/kconsole.h
r8eec3c8 rc0f13d2 47 47 ARG_TYPE_INT, 48 48 ARG_TYPE_STRING, 49 /** Optional string */ 50 ARG_TYPE_STRING_OPTIONAL, 49 51 /** Variable type - either symbol or string. */ 50 52 ARG_TYPE_VAR -
kernel/generic/include/proc/task.h
r8eec3c8 rc0f13d2 138 138 extern int task_kill(task_id_t); 139 139 extern void task_get_accounting(task_t *, uint64_t *, uint64_t *); 140 extern void task_print_list( void);140 extern void task_print_list(bool); 141 141 142 142 extern void cap_set(task_t *, cap_t); -
kernel/generic/src/console/cmd.c
r8eec3c8 rc0f13d2 207 207 }; 208 208 209 /* Data and methods for 'call0' command. */209 /* Data and methods for 'call0' and 'mcall0' command. */ 210 210 static char call0_buf[MAX_CMDLINE + 1]; 211 211 static char carg1_buf[MAX_CMDLINE + 1]; … … 363 363 }; 364 364 365 365 366 static int cmd_tasks(cmd_arg_t *argv); 367 static char tasks_buf[MAX_CMDLINE + 1]; 368 369 static cmd_arg_t tasks_argv = { 370 .type = ARG_TYPE_STRING_OPTIONAL, 371 .buffer = tasks_buf, 372 .len = sizeof(tasks_buf) 373 }; 366 374 static cmd_info_t tasks_info = { 367 375 .name = "tasks", 368 .description = "List all tasks .",376 .description = "List all tasks (use -a for additional information).", 369 377 .func = cmd_tasks, 370 .argc = 0 378 .argc = 1, 379 .argv = &tasks_argv 371 380 }; 372 381 … … 930 939 * @return Always 1 931 940 */ 932 int cmd_tasks(cmd_arg_t * argv) 933 { 934 task_print_list(); 941 int cmd_tasks(cmd_arg_t *argv) 942 { 943 if (str_cmp(tasks_buf, "-a") == 0) 944 task_print_list(true); 945 else if (str_cmp(tasks_buf, "") == 0) 946 task_print_list(false); 947 else 948 printf("Unknown argument \"%s\".\n", tasks_buf); 949 935 950 return 1; 936 951 } -
kernel/generic/src/console/kconsole.c
r8eec3c8 rc0f13d2 590 590 size_t i; 591 591 for (i = 0; i < cmd->argc; i++) { 592 char *buf; 593 592 594 start = end; 593 595 if (!parse_argument(cmdline, size, &start, &end)) { 596 if (cmd->argv[i].type == ARG_TYPE_STRING_OPTIONAL) { 597 buf = (char *) cmd->argv[i].buffer; 598 str_cpy(buf, cmd->argv[i].len, ""); 599 continue; 600 } 601 594 602 printf("Too few arguments.\n"); 595 603 spinlock_unlock(&cmd->lock); … … 597 605 } 598 606 599 char *buf;600 607 switch (cmd->argv[i].type) { 601 608 case ARG_TYPE_STRING: 609 case ARG_TYPE_STRING_OPTIONAL: 602 610 buf = (char *) cmd->argv[i].buffer; 603 611 str_ncpy(buf, cmd->argv[i].len, cmdline + start, -
kernel/generic/src/proc/task.c
r8eec3c8 rc0f13d2 465 465 static bool task_print_walker(avltree_node_t *node, void *arg) 466 466 { 467 bool *additional = (bool *) arg; 467 468 task_t *task = avltree_get_instance(node, task_t, tasks_tree_node); 468 469 irq_spinlock_lock(&task->lock, false); … … 476 477 477 478 #ifdef __32_BITS__ 478 printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %10p %10p %9" PRIu64 "%c %9" 479 PRIu64 "%c %7ld %6ld", task->taskid, task->name, task->context, 480 task, task->as, ucycles, usuffix, kcycles, ksuffix, 481 atomic_get(&task->refcount), atomic_get(&task->active_calls)); 479 if (*additional) 480 printf("%-8" PRIu64 " %9ld %7ld", task->taskid, 481 atomic_get(&task->refcount), atomic_get(&task->active_calls)); 482 else 483 printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %10p %10p" 484 " %9" PRIu64 "%c %9" PRIu64 "%c\n", task->taskid, 485 task->name, task->context, task, task->as, 486 ucycles, usuffix, kcycles, ksuffix); 482 487 #endif 483 488 484 489 #ifdef __64_BITS__ 485 printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %18p %18p %9" PRIu64 "%c %9" 486 PRIu64 "%c %7ld %6ld", task->taskid, task->name, task->context, 487 task, task->as, ucycles, usuffix, kcycles, ksuffix, 488 atomic_get(&task->refcount), atomic_get(&task->active_calls)); 489 #endif 490 491 size_t i; 492 for (i = 0; i < IPC_MAX_PHONES; i++) { 493 if (task->phones[i].callee) 494 printf(" %" PRIs ":%p", i, task->phones[i].callee); 490 if (*additional) 491 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c %9ld %7ld", 492 task->taskid, ucycles, usuffix, kcycles, ksuffix, 493 atomic_get(&task->refcount), atomic_get(&task->active_calls)); 494 else 495 printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %18p %18p\n", 496 task->taskid, task->name, task->context, task, task->as); 497 #endif 498 499 if (*additional) { 500 size_t i; 501 for (i = 0; i < IPC_MAX_PHONES; i++) { 502 if (task->phones[i].callee) 503 printf(" %" PRIs ":%p", i, task->phones[i].callee); 504 } 505 printf("\n"); 495 506 } 496 printf("\n");497 507 498 508 irq_spinlock_unlock(&task->lock, false); … … 500 510 } 501 511 502 /** Print task list */ 503 void task_print_list(void) 512 /** Print task list 513 * 514 * @param additional Print additional information. 515 * 516 */ 517 void task_print_list(bool additional) 504 518 { 505 519 /* Messing with task structures, avoid deadlock */ … … 507 521 508 522 #ifdef __32_BITS__ 509 printf("taskid name ctx address as " 510 " ucycles kcycles threads calls callee\n"); 511 printf("------ ------------ --- ---------- ----------" 512 " ---------- ---------- ------- ------ ------>\n"); 523 if (additional) 524 printf("[taskid] [threads] [calls] [callee\n"); 525 else 526 printf("[taskid] [name ] [ctx] [address ] [as ]" 527 " [ucycles ] [kcycles ]\n"); 513 528 #endif 514 529 515 530 #ifdef __64_BITS__ 516 printf("taskid name ctx address as " 517 " ucycles kcycles threads calls callee\n"); 518 printf("------ ------------ --- ------------------ ------------------" 519 " ---------- ---------- ---------- ------- ------ ------>\n"); 520 #endif 521 522 avltree_walk(&tasks_tree, task_print_walker, NULL); 531 if (additional) 532 printf("[taskid] [ucycles ] [kcycles ] [threads] [calls]" 533 " [callee\n"); 534 else 535 printf("[taskid] [name ] [ctx] [address ]" 536 " [as ]\n"); 537 #endif 538 539 avltree_walk(&tasks_tree, task_print_walker, &additional); 523 540 524 541 irq_spinlock_unlock(&tasks_lock, true);
Note:
See TracChangeset
for help on using the changeset viewer.