Changeset 34bba0e in mainline for uspace/app/ps/ps.c
- Timestamp:
- 2010-03-25T15:15:09Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a2a00e8
- Parents:
- f773206d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.