Changeset 34bba0e in mainline
- Timestamp:
- 2010-03-25T15:15:09Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a2a00e8
- Parents:
- f773206d
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ps/taskinfo.h
rf773206d r34bba0e 75 75 int priority; 76 76 uint64_t cycles; 77 unsigned int cpu; 77 78 } thread_info_t; 78 79 -
kernel/generic/src/ps/ps.c
rf773206d r34bba0e 170 170 result.cycles = t->cycles; 171 171 172 if (t->cpu) 173 result.cpu = t->cpu->id; 174 else 175 result.cpu = -1; 176 172 177 WRITE_THREAD_INFO(infos, count - 1, &result); 173 178 … … 187 192 spinlock_unlock(&tasks_lock); 188 193 194 if (!selected_task) { 195 return 0; 196 } 197 189 198 spinlock_lock(&threads_lock); 190 199 -
uspace/app/ps/ps.c
rf773206d r34bba0e 47 47 #define THREAD_COUNT 50 48 48 49 /** Thread states */ 50 static const char *thread_states[] = { 51 "Invalid", 52 "Running", 53 "Sleeping", 54 "Ready", 55 "Entering", 56 "Exiting", 57 "Lingering" 58 }; 59 49 60 static void list_tasks(void) 50 61 { … … 82 93 } 83 94 95 if (result == 0) { 96 printf("No task with given pid!\n"); 97 exit(1); 98 } 99 84 100 int i; 85 printf(" ID State Prio [k]Cycles\n");101 printf(" ID State CPU Prio [k]Cycles\n"); 86 102 for (i = 0; i < result; ++i) { 87 printf("%6llu % 8d %6d %12llu\n", threads[i].tid, threads[i].state,88 threads[i]. priority, threads[i].cycles / 1000);103 printf("%6llu %-8s %4u %6d %12llu\n", threads[i].tid, thread_states[threads[i].state], 104 threads[i].cpu, threads[i].priority, threads[i].cycles / 1000); 89 105 } 106 } 107 108 static void usage() 109 { 110 printf("Usage: ps [-t pid]\n"); 90 111 } 91 112 … … 100 121 if (argc != 1) { 101 122 printf("Bad argument count!\n"); 123 usage(); 102 124 exit(1); 103 125 } … … 106 128 } else { 107 129 printf("Unknown argument %s!\n", *argv); 130 usage(); 108 131 exit(1); 109 132 }
Note:
See TracChangeset
for help on using the changeset viewer.