- Timestamp:
- 2010-04-09T09:41:39Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 638927a
- Parents:
- a325832
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/ps/ps.c
ra325832 rfaf38b2 99 99 int thread_count = THREAD_COUNT; 100 100 thread_info_t *threads = malloc(thread_count * sizeof(thread_info_t)); 101 int result = get_task_threads(t askid, threads, sizeof(thread_info_t) * thread_count);101 int result = get_task_threads(threads, sizeof(thread_info_t) * thread_count); 102 102 103 103 while (result > thread_count) { 104 104 thread_count *= 2; 105 105 threads = realloc(threads, thread_count * sizeof(thread_info_t)); 106 result = get_task_threads(t askid, threads, sizeof(thread_info_t) * thread_count);106 result = get_task_threads(threads, sizeof(thread_info_t) * thread_count); 107 107 } 108 108 … … 115 115 printf(" ID State CPU Prio [k]uCycles [k]kcycles Cycle fault\n"); 116 116 for (i = 0; i < result; ++i) { 117 if (threads[i].taskid != taskid) { 118 continue; 119 } 117 120 uint64_t ucycles, kcycles; 118 121 char usuffix, ksuffix; -
uspace/app/top/ps.c
ra325832 rfaf38b2 86 86 int thread_count = THREAD_COUNT; 87 87 thread_info_t *threads = malloc(thread_count * sizeof(thread_info_t)); 88 int result = get_task_threads(t askid, threads, sizeof(thread_info_t) * thread_count);88 int result = get_task_threads(threads, sizeof(thread_info_t) * thread_count); 89 89 90 90 while (result > thread_count) { 91 91 thread_count *= 2; 92 92 threads = realloc(threads, thread_count * sizeof(thread_info_t)); 93 result = get_task_threads(t askid, threads, sizeof(thread_info_t) * thread_count);93 result = get_task_threads(threads, sizeof(thread_info_t) * thread_count); 94 94 } 95 95 -
uspace/lib/c/generic/ps.c
ra325832 rfaf38b2 74 74 * 75 75 */ 76 int get_task_threads(t ask_id_t taskid, thread_info_t *infos, size_t size)76 int get_task_threads(thread_info_t *infos, size_t size) 77 77 { 78 return __SYSCALL3(SYS_PS_GET_THREADS, (sysarg_t) &taskid, (sysarg_t) infos, 79 (sysarg_t) size); 78 return __SYSCALL2(SYS_PS_GET_THREADS, (sysarg_t) infos, (sysarg_t) size); 80 79 } 81 80 -
uspace/lib/c/include/ps.h
ra325832 rfaf38b2 45 45 extern size_t get_task_ids(task_id_t *ids, size_t size); 46 46 extern int get_task_info(task_id_t id, task_info_t *info); 47 extern int get_task_threads(t ask_id_t taskid, thread_info_t *infos, size_t size);47 extern int get_task_threads(thread_info_t *infos, size_t size); 48 48 49 49 #endif
Note:
See TracChangeset
for help on using the changeset viewer.