Changeset 62550dce in mainline for uspace/app/ps/ps.c
- Timestamp:
- 2010-04-01T21:31:25Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dd6c71c
- Parents:
- 79edc36
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/ps/ps.c
r79edc36 r62550dce 43 43 #include <malloc.h> 44 44 #include <load.h> 45 #include <sysinfo.h> 45 46 46 47 #include "func.h" … … 141 142 } 142 143 144 static void echo_cpus(void) 145 { 146 size_t cpu_count = sysinfo_value("cpu.count"); 147 printf("Found %u cpu's:\n", cpu_count); 148 uspace_cpu_info_t *cpus = malloc(cpu_count * sizeof(uspace_cpu_info_t)); 149 get_cpu_info(cpus); 150 size_t i; 151 for (i = 0; i < cpu_count; ++i) { 152 printf("%2u (%4u Mhz): Busy ticks: %8llu, Idle ticks: %8llu\n", cpus[i].id, 153 (size_t)cpus[i].frequency_mhz, cpus[i].busy_ticks, cpus[i].idle_ticks); 154 } 155 } 156 143 157 static void usage() 144 158 { 145 printf("Usage: ps [-t pid -l]\n");159 printf("Usage: ps [-t pid|-l|-c]\n"); 146 160 } 147 161 … … 169 183 } 170 184 echo_load(); 185 } else if (str_cmp(*argv, "-c") == 0) { 186 --argc; ++argv; 187 if (argc != 0) { 188 printf("Bad argument count!\n"); 189 usage(); 190 exit(1); 191 } 192 echo_cpus(); 171 193 } else { 172 194 printf("Unknown argument %s!\n", *argv);
Note:
See TracChangeset
for help on using the changeset viewer.