Changeset 62550dce in mainline
- 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
- Files:
-
- 3 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile
r79edc36 r62550dce 231 231 generic/src/sysinfo/sysinfo.c \ 232 232 generic/src/ps/ps.c \ 233 generic/src/ps/cpu.c \ 233 234 generic/src/ps/load.c \ 234 235 generic/src/ps/uptime.c -
kernel/generic/include/ps/load.h
r79edc36 r62550dce 33 33 */ 34 34 35 #ifndef KERN_ LOAD_H_36 #define KERN_ LOAD_H_35 #ifndef KERN_PS_LOAD_H_ 36 #define KERN_PS_LOAD_H_ 37 37 38 38 extern void get_avenrun(unsigned long *loads, int shift); -
kernel/generic/include/ps/ps.h
r79edc36 r62550dce 33 33 */ 34 34 35 #ifndef KERN_PS_ H_36 #define KERN_PS_ H_35 #ifndef KERN_PS_PS_H_ 36 #define KERN_PS_PS_H_ 37 37 38 38 #include <ps/taskinfo.h> 39 #include <ps/cpuinfo.h> 39 40 40 41 extern size_t sys_ps_get_tasks(task_id_t *uspace_ids, size_t size); 41 42 extern int sys_ps_get_task_info(task_id_t *uspace_id, task_info_t *uspace_info); 42 43 extern int sys_ps_get_threads(task_id_t *uspace_id, thread_info_t *uspace_infos, size_t size); 44 extern int sys_ps_get_cpu_info(uspace_cpu_info_t *uspace_cpu); 43 45 44 46 #endif -
kernel/generic/include/ps/uptime.h
r79edc36 r62550dce 33 33 */ 34 34 35 #ifndef KERN_ UPTIME_H_36 #define KERN_ UPTIME_H_35 #ifndef KERN_PS_UPTIME_H_ 36 #define KERN_PS_UPTIME_H_ 37 37 38 38 extern int sys_ps_get_uptime(uint64_t *user_load); -
kernel/generic/include/syscall/syscall.h
r79edc36 r62550dce 88 88 SYS_DEBUG_DISABLE_CONSOLE, 89 89 90 SYS_PS_GET_CPU_INFO, 90 91 SYS_PS_GET_TASKS, 91 92 SYS_PS_GET_TASK_INFO, -
kernel/generic/src/cpu/cpu.c
r79edc36 r62550dce 48 48 #include <adt/list.h> 49 49 #include <print.h> 50 #include <sysinfo/sysinfo.h> 50 51 51 52 cpu_t *cpus; … … 96 97 cpu_identify(); 97 98 cpu_arch_init(); 99 100 sysinfo_set_item_val("cpu.count", NULL, config.cpu_count); 98 101 } 99 102 -
kernel/generic/src/proc/scheduler.c
r79edc36 r62550dce 202 202 */ 203 203 204 spinlock_lock(&CPU->lock); 204 205 CPU->idle = true; 206 spinlock_unlock(&CPU->lock); 205 207 cpu_sleep(); 206 208 goto loop; -
kernel/generic/src/syscall/syscall.c
r79edc36 r62550dce 170 170 171 171 /* Ps calls */ 172 (syshandler_t) sys_ps_get_cpu_info, 172 173 (syshandler_t) sys_ps_get_tasks, 173 174 (syshandler_t) sys_ps_get_task_info, -
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); -
uspace/lib/c/Makefile
r79edc36 r62550dce 92 92 generic/stacktrace.c \ 93 93 generic/ps.c \ 94 generic/cpu.c \ 94 95 generic/load.c \ 95 96 generic/uptime.c -
uspace/lib/c/include/ps.h
r79edc36 r62550dce 38 38 #include <task.h> 39 39 #include <kernel/ps/taskinfo.h> 40 #include <kernel/ps/cpuinfo.h> 40 41 42 extern int get_cpu_info(uspace_cpu_info_t *cpus); 41 43 extern size_t get_task_ids(task_id_t *ids, size_t size); 42 44 extern int get_task_info(task_id_t id, task_info_t *info);
Note:
See TracChangeset
for help on using the changeset viewer.