Changeset 48dcc69 in mainline
- Timestamp:
- 2010-06-11T10:52:57Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- be06914
- Parents:
- c0f13d2
- Location:
- kernel/generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/proc/thread.h
rc0f13d2 r48dcc69 240 240 241 241 extern void thread_register_call_me(void (*)(void *), void *); 242 extern void thread_print_list( void);242 extern void thread_print_list(bool); 243 243 extern void thread_destroy(thread_t *, bool); 244 244 extern thread_t *thread_find_by_id(thread_id_t); -
kernel/generic/src/console/cmd.c
rc0f13d2 r48dcc69 355 355 }; 356 356 357 static char flag_buf[MAX_CMDLINE + 1]; 358 357 359 static int cmd_threads(cmd_arg_t *argv); 360 static cmd_arg_t threads_argv = { 361 .type = ARG_TYPE_STRING_OPTIONAL, 362 .buffer = flag_buf, 363 .len = sizeof(flag_buf) 364 }; 358 365 static cmd_info_t threads_info = { 359 366 .name = "threads", 360 .description = "List all threads .",367 .description = "List all threads (use -a for additional information).", 361 368 .func = cmd_threads, 362 .argc = 0363 }; 364 369 .argc = 1, 370 .argv = &threads_argv 371 }; 365 372 366 373 static int cmd_tasks(cmd_arg_t *argv); 367 static char tasks_buf[MAX_CMDLINE + 1];368 369 374 static cmd_arg_t tasks_argv = { 370 375 .type = ARG_TYPE_STRING_OPTIONAL, 371 .buffer = tasks_buf,372 .len = sizeof( tasks_buf)376 .buffer = flag_buf, 377 .len = sizeof(flag_buf) 373 378 }; 374 379 static cmd_info_t tasks_info = { … … 923 928 /** Command for listings Thread information 924 929 * 925 * @param argv Ignore s930 * @param argv Ignored 926 931 * 927 932 * @return Always 1 928 933 */ 929 int cmd_threads(cmd_arg_t * argv) 930 { 931 thread_print_list(); 934 int cmd_threads(cmd_arg_t *argv) 935 { 936 if (str_cmp(flag_buf, "-a") == 0) 937 thread_print_list(true); 938 else if (str_cmp(flag_buf, "") == 0) 939 thread_print_list(false); 940 else 941 printf("Unknown argument \"%s\".\n", flag_buf); 942 932 943 return 1; 933 944 } … … 935 946 /** Command for listings Task information 936 947 * 937 * @param argv Ignore s948 * @param argv Ignored 938 949 * 939 950 * @return Always 1 … … 941 952 int cmd_tasks(cmd_arg_t *argv) 942 953 { 943 if (str_cmp( tasks_buf, "-a") == 0)954 if (str_cmp(flag_buf, "-a") == 0) 944 955 task_print_list(true); 945 else if (str_cmp( tasks_buf, "") == 0)956 else if (str_cmp(flag_buf, "") == 0) 946 957 task_print_list(false); 947 958 else 948 printf("Unknown argument \"%s\".\n", tasks_buf);959 printf("Unknown argument \"%s\".\n", flag_buf); 949 960 950 961 return 1; -
kernel/generic/src/proc/task.c
rc0f13d2 r48dcc69 522 522 #ifdef __32_BITS__ 523 523 if (additional) 524 printf("[ taskid] [threads] [calls] [callee\n");524 printf("[id ] [threads] [calls] [callee\n"); 525 525 else 526 printf("[ taskid] [name ] [ctx] [address ] [as ]"526 printf("[id ] [name ] [ctx] [address ] [as ]" 527 527 " [ucycles ] [kcycles ]\n"); 528 528 #endif -
kernel/generic/src/proc/thread.c
rc0f13d2 r48dcc69 605 605 static bool thread_walker(avltree_node_t *node, void *arg) 606 606 { 607 bool *additional = (bool *) arg; 607 608 thread_t *thread = avltree_get_instance(node, thread_t, threads_tree_node); 608 609 … … 613 614 614 615 #ifdef __32_BITS__ 615 printf("%-6" PRIu64" %-10s %10p %-8s %10p %-3" PRIu32 " %10p %10p %9" 616 PRIu64 "%c %9" PRIu64 "%c ", thread->tid, thread->name, thread, 617 thread_states[thread->state], thread->task, thread->task->context, 618 thread->thread_code, thread->kstack, ucycles, usuffix, kcycles, ksuffix); 616 if (*additional) 617 printf("%-8" PRIu64" %10p %9" PRIu64 "%c %9" PRIu64 "%c ", 618 thread->tid, thread->kstack, ucycles, usuffix, 619 kcycles, ksuffix); 620 else 621 printf("%-8" PRIu64" %-14s %10p %-8s %10p %-5" PRIu32 " %10p\n", 622 thread->tid, thread->name, thread, thread_states[thread->state], 623 thread->task, thread->task->context, thread->thread_code); 619 624 #endif 620 625 621 626 #ifdef __64_BITS__ 622 printf("%-6" PRIu64" %-10s %18p %-8s %18p %-3" PRIu32 " %18p %18p %9" 623 PRIu64 "%c %9" PRIu64 "%c ", thread->tid, thread->name, thread, 624 thread_states[thread->state], thread->task, thread->task->context, 625 thread->thread_code, thread->kstack, ucycles, usuffix, kcycles, ksuffix); 626 #endif 627 628 if (thread->cpu) 629 printf("%-4u", thread->cpu->id); 627 if (*additional) 628 printf("%-8" PRIu64" %18p %18p\n" 629 " %9" PRIu64 "%c %9" PRIu64 "%c ", 630 thread->tid, thread->thread_code, thread->kstack, 631 ucycles, usuffix, kcycles, ksuffix); 630 632 else 631 printf("none"); 632 633 if (thread->state == Sleeping) { 633 printf("%-8" PRIu64" %-14s %18p %-8s %18p %-5" PRIu32 "\n", 634 thread->tid, thread->name, thread, thread_states[thread->state], 635 thread->task, thread->task->context); 636 #endif 637 638 if (*additional) { 639 if (thread->cpu) 640 printf("%-5u", thread->cpu->id); 641 else 642 printf("none "); 643 644 if (thread->state == Sleeping) { 634 645 #ifdef __32_BITS__ 635 printf(" %10p", thread->sleep_queue); 636 #endif 646 printf(" %10p", thread->sleep_queue); 647 #endif 648 649 #ifdef __64_BITS__ 650 printf(" %18p", thread->sleep_queue); 651 #endif 652 } 637 653 638 #ifdef __64_BITS__ 639 printf(" %18p", thread->sleep_queue); 640 #endif 654 printf("\n"); 641 655 } 642 656 643 printf("\n");644 645 657 return true; 646 658 } … … 648 660 /** Print list of threads debug info 649 661 * 650 */ 651 void thread_print_list(void) 662 * @param additional Print additional information. 663 * 664 */ 665 void thread_print_list(bool additional) 652 666 { 653 667 /* Messing with thread structures, avoid deadlock */ … … 655 669 656 670 #ifdef __32_BITS__ 657 printf("tid name address state task "658 "ctx code stack ucycles kcycles cpu"659 "waitqueue\n");660 printf("------ ---------- ---------- -------- ---------- "661 "--- ---------- ---------- ---------- ---------- ----"662 "----------\n");671 if (additional) 672 printf("[id ] [stack ] [ucycles ] [kcycles ] [cpu]" 673 " [waitqueue]\n"); 674 else 675 printf("[id ] [name ] [address ] [state ] [task ]" 676 " [ctx] [code ]\n"); 663 677 #endif 664 678 665 679 #ifdef __64_BITS__ 666 printf("tid name address state task "667 "ctx code stack ucycles kcycles cpu"668 "waitqueue\n");669 printf("------ ---------- ------------------ -------- ------------------ "670 "--- ------------------ ------------------ ---------- ---------- ----"671 "------------------\n");672 #endif 673 674 avltree_walk(&threads_tree, thread_walker, NULL);680 if (additional) { 681 printf("[id ] [code ] [stack ]\n" 682 " [ucycles ] [kcycles ] [cpu] [waitqueue ]\n"); 683 } else 684 printf("[id ] [name ] [address ] [state ]" 685 " [task ] [ctx]\n"); 686 #endif 687 688 avltree_walk(&threads_tree, thread_walker, &additional); 675 689 676 690 irq_spinlock_unlock(&threads_lock, true);
Note:
See TracChangeset
for help on using the changeset viewer.