Changeset dec16a2 in mainline for uspace/app/tasks/tasks.c
- Timestamp:
- 2010-04-18T16:52:47Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5c45ca8
- Parents:
- e535eeb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tasks/tasks.c
re535eeb rdec16a2 59 59 { 60 60 size_t count; 61 task_id_t *ids = 62 (task_id_t *) stats_get_tasks(&count); 63 64 if (ids == NULL) { 61 stats_task_t *stats_tasks = stats_get_tasks(&count); 62 63 if (stats_tasks == NULL) { 65 64 fprintf(stderr, "%s: Unable to get tasks\n", NAME); 66 65 return; … … 71 70 size_t i; 72 71 for (i = 0; i < count; i++) { 73 stats_task_t *stats_task = stats_get_task(ids[i]); 74 if (stats_task != NULL) { 75 uint64_t virtmem, ucycles, kcycles; 76 char vmsuffix, usuffix, ksuffix; 77 78 order_suffix(stats_task->virtmem, &virtmem, &vmsuffix); 79 order_suffix(stats_task->ucycles, &ucycles, &usuffix); 80 order_suffix(stats_task->kcycles, &kcycles, &ksuffix); 81 82 printf("%8" PRIu64 "%8u %8" PRIu64"%c %12" 83 PRIu64 "%c %12" PRIu64 "%c %s\n", ids[i], stats_task->threads, 84 virtmem, vmsuffix, ucycles, usuffix, kcycles, ksuffix, 85 stats_task->name); 86 87 free(stats_task); 88 } else 89 printf("%8" PRIu64 "\n", ids[i]); 90 } 91 92 free(ids); 72 uint64_t virtmem, ucycles, kcycles; 73 char vmsuffix, usuffix, ksuffix; 74 75 order_suffix(stats_tasks[i].virtmem, &virtmem, &vmsuffix); 76 order_suffix(stats_tasks[i].ucycles, &ucycles, &usuffix); 77 order_suffix(stats_tasks[i].kcycles, &kcycles, &ksuffix); 78 79 printf("%8" PRIu64 "%8u %8" PRIu64"%c %12" 80 PRIu64 "%c %12" PRIu64 "%c %s\n", stats_tasks[i].task_id, 81 stats_tasks[i].threads, virtmem, vmsuffix, ucycles, usuffix, 82 kcycles, ksuffix, stats_tasks[i].name); 83 } 84 85 free(stats_tasks); 93 86 } 94 87 … … 96 89 { 97 90 size_t count; 98 thread_id_t *ids = 99 (thread_id_t *) stats_get_threads(&count); 100 101 if (ids == NULL) { 91 stats_thread_t *stats_threads = stats_get_threads(&count); 92 93 if (stats_threads == NULL) { 102 94 fprintf(stderr, "%s: Unable to get threads\n", NAME); 103 95 return; … … 107 99 size_t i; 108 100 for (i = 0; i < count; i++) { 109 stats_thread_t *stats_thread = stats_get_thread(ids[i]); 110 if (stats_thread != NULL) { 111 if ((all) || (stats_thread->task_id == task_id)) { 112 uint64_t ucycles, kcycles; 113 char usuffix, ksuffix; 114 115 order_suffix(stats_thread->ucycles, &ucycles, &usuffix); 116 order_suffix(stats_thread->kcycles, &kcycles, &ksuffix); 117 118 if (stats_thread->on_cpu) { 119 printf("%8" PRIu64 " %-8s %4u %6d %12" 120 PRIu64"%c %12" PRIu64"%c\n", ids[i], 121 thread_get_state(stats_thread->state), 122 stats_thread->cpu, stats_thread->priority, 123 ucycles, usuffix, kcycles, ksuffix); 124 } else { 125 printf("%8" PRIu64 " %-8s ---- %6d %12" 126 PRIu64"%c %12" PRIu64"%c\n", ids[i], 127 thread_get_state(stats_thread->state), 128 stats_thread->priority, 129 ucycles, usuffix, kcycles, ksuffix); 130 } 101 if ((all) || (stats_threads[i].task_id == task_id)) { 102 uint64_t ucycles, kcycles; 103 char usuffix, ksuffix; 104 105 order_suffix(stats_threads[i].ucycles, &ucycles, &usuffix); 106 order_suffix(stats_threads[i].kcycles, &kcycles, &ksuffix); 107 108 if (stats_threads[i].on_cpu) { 109 printf("%8" PRIu64 " %-8s %4u %6d %12" 110 PRIu64"%c %12" PRIu64"%c\n", stats_threads[i].thread_id, 111 thread_get_state(stats_threads[i].state), 112 stats_threads[i].cpu, stats_threads[i].priority, 113 ucycles, usuffix, kcycles, ksuffix); 114 } else { 115 printf("%8" PRIu64 " %-8s ---- %6d %12" 116 PRIu64"%c %12" PRIu64"%c\n", stats_threads[i].thread_id, 117 thread_get_state(stats_threads[i].state), 118 stats_threads[i].priority, 119 ucycles, usuffix, kcycles, ksuffix); 131 120 } 132 133 free(stats_thread); 134 } else if (all) 135 printf("%8" PRIu64 "\n", ids[i]); 136 } 137 138 free(ids); 121 } 122 } 123 124 free(stats_threads); 139 125 } 140 126
Note:
See TracChangeset
for help on using the changeset viewer.