Changeset 88dea9d in mainline
- Timestamp:
- 2010-04-17T16:28:49Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 30a5470
- Parents:
- 5ba201d (diff), 95319bd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 40 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r5ba201d r88dea9d 92 92 $(USPACEDIR)/app/nettest2/nettest2 \ 93 93 $(USPACEDIR)/app/netecho/netecho \ 94 $(USPACEDIR)/app/ping/ping 94 $(USPACEDIR)/app/ping/ping \ 95 $(USPACEDIR)/app/ps/ps \ 96 $(USPACEDIR)/app/top/top \ 97 $(USPACEDIR)/app/uptime/uptime \ 98 $(USPACEDIR)/app/dummy_load/dummy_load 95 99 96 100 COMPONENTS = \ -
kernel/Makefile
r5ba201d r88dea9d 229 229 generic/src/ipc/event.c \ 230 230 generic/src/security/cap.c \ 231 generic/src/sysinfo/sysinfo.c 231 generic/src/sysinfo/sysinfo.c \ 232 generic/src/ps/ps.c \ 233 generic/src/ps/cpu.c \ 234 generic/src/ps/load.c \ 235 generic/src/ps/uptime.c \ 236 generic/src/ps/mem.c 232 237 233 238 ## Kernel console support -
kernel/generic/include/cpu.h
r5ba201d r88dea9d 68 68 are disabled. */ 69 69 70 bool idle; 71 uint64_t idle_ticks; 72 uint64_t busy_ticks; 73 70 74 /** 71 75 * Processor ID assigned by kernel. -
kernel/generic/include/mm/frame.h
r5ba201d r88dea9d 170 170 extern void zone_merge_all(void); 171 171 extern uint64_t zone_total_size(void); 172 extern void zone_busy_and_free(uint64_t *out_busy, uint64_t *out_free); 172 173 173 174 /* -
kernel/generic/include/proc/task.h
r5ba201d r88dea9d 57 57 #include <mm/as.h> 58 58 59 # define TASK_NAME_BUFLEN 2059 #include <ps/taskinfo.h> 60 60 61 61 struct thread; … … 94 94 answerbox_t answerbox; /**< Communication endpoint */ 95 95 phone_t phones[IPC_MAX_PHONES]; 96 task_ipc_info_t ipc_info; /**< IPC statistics */ 96 97 /** 97 98 * Active asynchronous messages. It is used for limiting uspace to … … 122 123 123 124 /** Accumulated accounting. */ 124 uint64_t cycles; 125 uint64_t ucycles; 126 uint64_t kcycles; 125 127 } task_t; 126 128 … … 134 136 extern task_t *task_find_by_id(task_id_t id); 135 137 extern int task_kill(task_id_t id); 136 extern uint64_t task_get_accounting(task_t *t);138 extern void task_get_accounting(task_t *t, uint64_t *ucycles, uint64_t *kcycles); 137 139 extern void task_print_list(void); 138 140 -
kernel/generic/include/proc/thread.h
r5ba201d r88dea9d 69 69 #define THREAD_FLAG_NOATTACH (1 << 3) 70 70 71 /** Thread states. */ 72 typedef enum { 73 /** It is an error, if thread is found in this state. */ 74 Invalid, 75 /** State of a thread that is currently executing on some CPU. */ 76 Running, 77 /** Thread in this state is waiting for an event. */ 78 Sleeping, 79 /** State of threads in a run queue. */ 80 Ready, 81 /** Threads are in this state before they are first readied. */ 82 Entering, 83 /** After a thread calls thread_exit(), it is put into Exiting state. */ 84 Exiting, 85 /** Threads that were not detached but exited are Lingering. */ 86 Lingering 87 } state_t; 71 /* We need state_t enum definition */ 72 #include <ps/taskinfo.h> 88 73 89 74 /** Thread structure. There is one per thread. */ … … 189 174 190 175 /** Thread accounting. */ 191 uint64_t cycles; 176 uint64_t ucycles; 177 uint64_t kcycles; 192 178 /** Last sampled cycle. */ 193 179 uint64_t last_cycle; … … 252 238 extern void thread_print_list(void); 253 239 extern void thread_destroy(thread_t *); 254 extern void thread_update_accounting( void);240 extern void thread_update_accounting(bool); 255 241 extern bool thread_exists(thread_t *); 256 242 -
kernel/generic/include/syscall/syscall.h
r5ba201d r88dea9d 89 89 SYS_DEBUG_ENABLE_CONSOLE, 90 90 SYS_DEBUG_DISABLE_CONSOLE, 91 92 SYS_PS_GET_CPU_INFO, 93 SYS_PS_GET_MEM_INFO, 94 SYS_PS_GET_TASKS, 95 SYS_PS_GET_TASK_INFO, 96 SYS_PS_GET_THREADS, 97 SYS_PS_GET_UPTIME, 98 SYS_PS_GET_LOAD, 99 91 100 SYS_IPC_CONNECT_KBOX, 92 101 SYSCALL_END -
kernel/generic/src/console/cmd.c
r5ba201d r88dea9d 1049 1049 ipl_t ipl = interrupts_disable(); 1050 1050 spinlock_lock(&TASK->lock); 1051 uint64_t t0 = task_get_accounting(TASK); 1051 uint64_t ucycles0, kcycles0; 1052 task_get_accounting(TASK, &ucycles0, &kcycles0); 1052 1053 spinlock_unlock(&TASK->lock); 1053 1054 interrupts_restore(ipl); … … 1058 1059 1059 1060 /* Update and read thread accounting */ 1061 uint64_t ucycles1, kcycles1; 1060 1062 ipl = interrupts_disable(); 1061 1063 spinlock_lock(&TASK->lock); 1062 uint64_t dt = task_get_accounting(TASK) - t0;1064 task_get_accounting(TASK, &ucycles1, &kcycles1); 1063 1065 spinlock_unlock(&TASK->lock); 1064 1066 interrupts_restore(ipl); 1065 1067 1066 uint64_t cycles; 1067 char suffix; 1068 order(dt, &cycles, &suffix); 1069 1070 printf("Time: %" PRIu64 "%c cycles\n", cycles, suffix); 1068 uint64_t ucycles, kcycles; 1069 char usuffix, ksuffix; 1070 order(ucycles1 - ucycles0, &ucycles, &usuffix); 1071 order(kcycles1 - kcycles0, &kcycles, &ksuffix); 1072 1073 printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n", 1074 ucycles, usuffix, kcycles, ksuffix); 1071 1075 1072 1076 if (ret == NULL) { … … 1083 1087 uint32_t i; 1084 1088 bool ret = true; 1085 uint64_t cycles;1086 char suffix;1089 uint64_t ucycles, kcycles; 1090 char usuffix, ksuffix; 1087 1091 1088 1092 if (cnt < 1) … … 1102 1106 ipl_t ipl = interrupts_disable(); 1103 1107 spinlock_lock(&TASK->lock); 1104 uint64_t t0 = task_get_accounting(TASK); 1108 uint64_t ucycles0, kcycles0; 1109 task_get_accounting(TASK, &ucycles0, &kcycles0); 1105 1110 spinlock_unlock(&TASK->lock); 1106 1111 interrupts_restore(ipl); … … 1113 1118 ipl = interrupts_disable(); 1114 1119 spinlock_lock(&TASK->lock); 1115 uint64_t dt = task_get_accounting(TASK) - t0; 1120 uint64_t ucycles1, kcycles1; 1121 task_get_accounting(TASK, &ucycles1, &kcycles1); 1116 1122 spinlock_unlock(&TASK->lock); 1117 1123 interrupts_restore(ipl); 1118 1124 1119 1125 if (ret != NULL) { 1120 1126 printf("%s\n", ret); … … 1123 1129 } 1124 1130 1125 data[i] = dt; 1126 order(dt, &cycles, &suffix); 1127 printf("OK (%" PRIu64 "%c cycles)\n", cycles, suffix); 1131 data[i] = ucycles1 - ucycles0 + kcycles1 - kcycles0; 1132 order(ucycles1 - ucycles0, &ucycles, &usuffix); 1133 order(kcycles1 - kcycles0, &kcycles, &ksuffix); 1134 printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n", 1135 ucycles, usuffix, kcycles, ksuffix); 1128 1136 } 1129 1137 … … 1137 1145 } 1138 1146 1139 order(sum / (uint64_t) cnt, & cycles, &suffix);1140 printf("Average\t\t%" PRIu64 "%c\n", cycles,suffix);1147 order(sum / (uint64_t) cnt, &ucycles, &usuffix); 1148 printf("Average\t\t%" PRIu64 "%c\n", ucycles, usuffix); 1141 1149 } 1142 1150 -
kernel/generic/src/cpu/cpu.c
r5ba201d r88dea9d 48 48 #include <adt/list.h> 49 49 #include <print.h> 50 #include <sysinfo/sysinfo.h> 50 51 51 52 cpu_t *cpus; … … 74 75 75 76 cpus[i].id = i; 77 cpus[i].idle_ticks = 0; 78 cpus[i].busy_ticks = 0; 76 79 77 80 spinlock_initialize(&cpus[i].lock, "cpu_t.lock"); … … 94 97 cpu_identify(); 95 98 cpu_arch_init(); 99 100 sysinfo_set_item_val("cpu.count", NULL, config.cpu_count); 96 101 } 97 102 -
kernel/generic/src/interrupt/interrupt.c
r5ba201d r88dea9d 51 51 #include <print.h> 52 52 #include <symtab.h> 53 #include <proc/thread.h> 53 54 54 55 static struct { … … 91 92 ASSERT(n < IVT_ITEMS); 92 93 94 /* Account user cycles */ 95 if (THREAD) 96 thread_update_accounting(true); 97 93 98 #ifdef CONFIG_UDEBUG 94 99 if (THREAD) THREAD->udebug.uspace_state = istate; … … 104 109 if (THREAD && THREAD->interrupted && istate_from_uspace(istate)) 105 110 thread_exit(); 111 112 if (THREAD) 113 thread_update_accounting(false); 106 114 } 107 115 -
kernel/generic/src/ipc/ipc.c
r5ba201d r88dea9d 219 219 bool do_lock = ((!selflocked) || callerbox != (&TASK->answerbox)); 220 220 221 /* Count sent answer */ 222 spinlock_lock(&TASK->lock); 223 TASK->ipc_info.answer_sent++; 224 spinlock_unlock(&TASK->lock); 225 221 226 call->flags |= IPC_CALL_ANSWERED; 222 227 … … 276 281 static void _ipc_call(phone_t *phone, answerbox_t *box, call_t *call) 277 282 { 283 /* Count sent ipc call */ 284 spinlock_lock(&TASK->lock); 285 TASK->ipc_info.call_sent++; 286 spinlock_unlock(&TASK->lock); 287 278 288 if (!(call->flags & IPC_CALL_FORWARDED)) { 279 289 atomic_inc(&phone->active_calls); … … 376 386 int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox, int mode) 377 387 { 388 /* Count forwarded calls */ 389 spinlock_lock(&TASK->lock); 390 TASK->ipc_info.forwarded++; 391 spinlock_unlock(&TASK->lock); 392 378 393 spinlock_lock(&oldbox->lock); 379 394 list_remove(&call->link); … … 416 431 spinlock_lock(&box->lock); 417 432 if (!list_empty(&box->irq_notifs)) { 433 434 /* Count recieved IRQ notification */ 435 spinlock_lock(&TASK->lock); 436 TASK->ipc_info.irq_notif_recieved++; 437 spinlock_unlock(&TASK->lock); 438 418 439 ipl = interrupts_disable(); 419 440 spinlock_lock(&box->irq_lock); … … 425 446 interrupts_restore(ipl); 426 447 } else if (!list_empty(&box->answers)) { 448 /* Count recieved answer */ 449 spinlock_lock(&TASK->lock); 450 TASK->ipc_info.answer_recieved++; 451 spinlock_unlock(&TASK->lock); 452 427 453 /* Handle asynchronous answers */ 428 454 request = list_get_instance(box->answers.next, call_t, link); … … 430 456 atomic_dec(&request->data.phone->active_calls); 431 457 } else if (!list_empty(&box->calls)) { 458 /* Count recieved call */ 459 spinlock_lock(&TASK->lock); 460 TASK->ipc_info.call_recieved++; 461 spinlock_unlock(&TASK->lock); 462 432 463 /* Handle requests */ 433 464 request = list_get_instance(box->calls.next, call_t, link); -
kernel/generic/src/main/kinit.c
r5ba201d r88dea9d 67 67 #include <debug.h> 68 68 #include <str.h> 69 #include <ps/load.h> 69 70 70 71 #ifdef CONFIG_SMP … … 163 164 #endif /* CONFIG_KCONSOLE */ 164 165 166 /* Start thread computing system load */ 167 thread = thread_create(kload_thread, NULL, TASK, 0, "kload", false); 168 if (thread != NULL) 169 thread_ready(thread); 170 else 171 printf("Unable to create kload thread\n"); 172 165 173 interrupts_enable(); 166 174 -
kernel/generic/src/main/main.c
r5ba201d r88dea9d 226 226 printf("Detected %" PRIs " CPU(s), %" PRIu64" MiB free memory\n", 227 227 config.cpu_count, SIZE2MB(zone_total_size())); 228 228 229 229 LOG_EXEC(cpu_init()); 230 230 -
kernel/generic/src/mm/frame.c
r5ba201d r88dea9d 1218 1218 } 1219 1219 1220 void zone_busy_and_free(uint64_t *out_busy, uint64_t *out_free) 1221 { 1222 ipl_t ipl = interrupts_disable(); 1223 spinlock_lock(&zones.lock); 1224 1225 uint64_t busy = 0, free = 0; 1226 size_t i; 1227 for (i = 0; i < zones.count; i++) { 1228 bool available = zone_flags_available(zones.info[i].flags); 1229 /* Do not count reserved memory */ 1230 if (available) { 1231 busy += (uint64_t) FRAMES2SIZE(zones.info[i].busy_count); 1232 free += (uint64_t) FRAMES2SIZE(zones.info[i].free_count); 1233 } 1234 } 1235 1236 spinlock_unlock(&zones.lock); 1237 interrupts_restore(ipl); 1238 *out_busy = busy; 1239 *out_free = free; 1240 } 1241 1220 1242 /** Prints list of zones. */ 1221 1243 void zone_print_list(void) -
kernel/generic/src/proc/scheduler.c
r5ba201d r88dea9d 202 202 */ 203 203 204 spinlock_lock(&CPU->lock); 205 CPU->idle = true; 206 spinlock_unlock(&CPU->lock); 204 207 cpu_sleep(); 205 208 goto loop; … … 313 316 spinlock_lock(&THREAD->lock); 314 317 315 /* Update thread accounting */316 THREAD-> cycles += get_cycle() - THREAD->last_cycle;318 /* Update thread kernel accounting */ 319 THREAD->kcycles += get_cycle() - THREAD->last_cycle; 317 320 318 321 #ifndef CONFIG_FPU_LAZY -
kernel/generic/src/proc/task.c
r5ba201d r88dea9d 186 186 ta->context = CONTEXT; 187 187 ta->capabilities = 0; 188 ta->cycles = 0; 189 188 ta->ucycles = 0; 189 ta->kcycles = 0; 190 191 ta->ipc_info.call_sent = 0; 192 ta->ipc_info.call_recieved = 0; 193 ta->ipc_info.answer_sent = 0; 194 ta->ipc_info.answer_recieved = 0; 195 ta->ipc_info.irq_notif_recieved = 0; 196 ta->ipc_info.forwarded = 0; 197 190 198 #ifdef CONFIG_UDEBUG 191 199 /* Init debugging stuff */ … … 324 332 * already disabled. 325 333 * 326 * @param t Pointer to task.327 * 328 * @ return Number of cycles used by the task and all its threads329 * so far.330 * 331 */ 332 uint64_t task_get_accounting(task_t *t) 333 { 334 /* Accumulated value of task */335 uint64_t ret = t->cycles;334 * @param t Pointer to thread. 335 * @param ucycles Out pointer to sum of all user cycles. 336 * @param kcycles Out pointer to sum of all kernel cycles. 337 * 338 */ 339 void task_get_accounting(task_t *t, uint64_t *ucycles, uint64_t *kcycles) 340 { 341 /* Accumulated values of task */ 342 uint64_t uret = t->ucycles; 343 uint64_t kret = t->kcycles; 336 344 337 345 /* Current values of threads */ … … 345 353 if (thr == THREAD) { 346 354 /* Update accounting of current thread */ 347 thread_update_accounting( );355 thread_update_accounting(false); 348 356 } 349 ret += thr->cycles; 357 uret += thr->ucycles; 358 kret += thr->kcycles; 350 359 } 351 360 spinlock_unlock(&thr->lock); 352 361 } 353 362 354 return ret; 363 *ucycles = uret; 364 *kcycles = kret; 355 365 } 356 366 … … 419 429 spinlock_lock(&t->lock); 420 430 421 uint64_t cycles; 422 char suffix; 423 order(task_get_accounting(t), &cycles, &suffix); 424 425 #ifdef __32_BITS__ 426 printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %10p %10p %9" PRIu64 427 "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, 428 suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls)); 431 uint64_t ucycles; 432 uint64_t kcycles; 433 char usuffix, ksuffix; 434 task_get_accounting(t, &ucycles, &kcycles); 435 order(ucycles, &ucycles, &usuffix); 436 order(kcycles, &kcycles, &ksuffix); 437 438 #ifdef __32_BITS__ 439 printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %10p %10p %9" PRIu64 "%c %9" 440 PRIu64 "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, 441 ucycles, usuffix, kcycles, ksuffix, atomic_get(&t->refcount), 442 atomic_get(&t->active_calls)); 429 443 #endif 430 444 431 445 #ifdef __64_BITS__ 432 printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %18p %18p %9" PRIu64 433 "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, 434 suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls)); 446 printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %18p %18p %9" PRIu64 "%c %9" 447 PRIu64 "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, 448 ucycles, usuffix, kcycles, ksuffix, atomic_get(&t->refcount), 449 atomic_get(&t->active_calls)); 435 450 #endif 436 451 … … 455 470 456 471 #ifdef __32_BITS__ 457 printf("taskid name ctx address as 458 " cyclesthreads calls callee\n");459 printf("------ ------------ --- ---------- ---------- 460 " ---------- ------- ------ ------>\n");472 printf("taskid name ctx address as " 473 " ucycles kcycles threads calls callee\n"); 474 printf("------ ------------ --- ---------- ----------" 475 " ---------- ---------- ------- ------ ------>\n"); 461 476 #endif 462 477 463 478 #ifdef __64_BITS__ 464 printf("taskid name ctx address as 465 " cyclesthreads calls callee\n");466 printf("------ ------------ --- ------------------ ------------------ 467 " ---------- ------- ------ ------>\n");479 printf("taskid name ctx address as " 480 " ucycles kcycles threads calls callee\n"); 481 printf("------ ------------ --- ------------------ ------------------" 482 " ---------- ---------- ---------- ------- ------ ------>\n"); 468 483 #endif 469 484 -
kernel/generic/src/proc/thread.c
r5ba201d r88dea9d 132 132 spinlock_lock(&THREAD->lock); 133 133 if (!THREAD->uncounted) { 134 thread_update_accounting(); 135 uint64_t cycles = THREAD->cycles; 136 THREAD->cycles = 0; 134 thread_update_accounting(true); 135 uint64_t ucycles = THREAD->ucycles; 136 THREAD->ucycles = 0; 137 uint64_t kcycles = THREAD->kcycles; 138 THREAD->kcycles = 0; 139 137 140 spinlock_unlock(&THREAD->lock); 138 141 139 142 spinlock_lock(&TASK->lock); 140 TASK->cycles += cycles; 143 TASK->ucycles += ucycles; 144 TASK->kcycles += kcycles; 141 145 spinlock_unlock(&TASK->lock); 142 146 } else … … 323 327 t->thread_arg = arg; 324 328 t->ticks = -1; 325 t->cycles = 0; 329 t->ucycles = 0; 330 t->kcycles = 0; 326 331 t->uncounted = uncounted; 327 332 t->priority = -1; /* start in rq[0] */ … … 614 619 thread_t *t = avltree_get_instance(node, thread_t, threads_tree_node); 615 620 616 uint64_t cycles; 617 char suffix; 618 order(t->cycles, &cycles, &suffix); 621 uint64_t ucycles, kcycles; 622 char usuffix, ksuffix; 623 order(t->ucycles, &ucycles, &usuffix); 624 order(t->kcycles, &kcycles, &ksuffix); 619 625 620 626 #ifdef __32_BITS__ 621 printf("%-6" PRIu64" %-10s %10p %-8s %10p %-3" PRIu32 " %10p %10p %9" PRIu64 "%c ", 622 t->tid, t->name, t, thread_states[t->state], t->task, 623 t->task->context, t->thread_code, t->kstack, cycles, suffix); 627 printf("%-6" PRIu64" %-10s %10p %-8s %10p %-3" PRIu32 " %10p %10p %9" 628 PRIu64 "%c %9" PRIu64 "%c ", t->tid, t->name, t, 629 thread_states[t->state], t->task, t->task->context, t->thread_code, 630 t->kstack, ucycles, usuffix, kcycles, ksuffix); 624 631 #endif 625 632 626 633 #ifdef __64_BITS__ 627 printf("%-6" PRIu64" %-10s %18p %-8s %18p %-3" PRIu32 " %18p %18p %9" PRIu64 "%c ", 628 t->tid, t->name, t, thread_states[t->state], t->task, 629 t->task->context, t->thread_code, t->kstack, cycles, suffix); 634 printf("%-6" PRIu64" %-10s %18p %-8s %18p %-3" PRIu32 " %18p %18p %9" 635 PRIu64 "%c %9" PRIu64 "%c ", t->tid, t->name, t, 636 thread_states[t->state], t->task, t->task->context, t->thread_code, 637 t->kstack, ucycles, usuffix, kcycles, ksuffix); 630 638 #endif 631 639 … … 661 669 #ifdef __32_BITS__ 662 670 printf("tid name address state task " 663 "ctx code stack cyclescpu "671 "ctx code stack ucycles kcycles cpu " 664 672 "waitqueue\n"); 665 673 printf("------ ---------- ---------- -------- ---------- " 666 "--- ---------- ---------- ---------- ---- "674 "--- ---------- ---------- ---------- ---------- ---- " 667 675 "----------\n"); 668 676 #endif … … 670 678 #ifdef __64_BITS__ 671 679 printf("tid name address state task " 672 "ctx code stack cyclescpu "680 "ctx code stack ucycles kcycles cpu " 673 681 "waitqueue\n"); 674 682 printf("------ ---------- ------------------ -------- ------------------ " 675 "--- ------------------ ------------------ ---------- ---- "683 "--- ------------------ ------------------ ---------- ---------- ---- " 676 684 "------------------\n"); 677 685 #endif … … 706 714 * interrupts must be already disabled. 707 715 * 708 */ 709 void thread_update_accounting(void) 716 * @param user True to update user accounting, false for kernel. 717 */ 718 void thread_update_accounting(bool user) 710 719 { 711 720 uint64_t time = get_cycle(); 712 THREAD->cycles += time - THREAD->last_cycle; 721 if (user) { 722 THREAD->ucycles += time - THREAD->last_cycle; 723 } else { 724 THREAD->kcycles += time - THREAD->last_cycle; 725 } 713 726 THREAD->last_cycle = time; 714 727 } -
kernel/generic/src/synch/waitq.c
r5ba201d r88dea9d 54 54 #include <context.h> 55 55 #include <adt/list.h> 56 #include <arch/cycle.h> 56 57 57 58 static void waitq_sleep_timed_out(void *data); … … 373 374 if (!context_save(&THREAD->sleep_interruption_context)) { 374 375 /* Short emulation of scheduler() return code. */ 376 THREAD->last_cycle = get_cycle(); 375 377 spinlock_unlock(&THREAD->lock); 376 378 return ESYNCH_INTERRUPTED; … … 385 387 if (!context_save(&THREAD->sleep_timeout_context)) { 386 388 /* Short emulation of scheduler() return code. */ 389 THREAD->last_cycle = get_cycle(); 387 390 spinlock_unlock(&THREAD->lock); 388 391 return ESYNCH_TIMEOUT; -
kernel/generic/src/syscall/syscall.c
r5ba201d r88dea9d 54 54 #include <console/console.h> 55 55 #include <udebug/udebug.h> 56 #include <ps/ps.h> 57 #include <ps/load.h> 58 #include <ps/uptime.h> 56 59 57 60 /** Dispatch system call */ … … 60 63 { 61 64 unative_t rc; 65 66 /* Do userpace accounting */ 67 thread_update_accounting(true); 62 68 63 69 #ifdef CONFIG_UDEBUG … … 95 101 } 96 102 #endif 103 104 /* Do kernel accounting */ 105 thread_update_accounting(false); 97 106 98 107 return rc; … … 161 170 (syshandler_t) sys_debug_enable_console, 162 171 (syshandler_t) sys_debug_disable_console, 172 173 /* Ps calls */ 174 (syshandler_t) sys_ps_get_cpu_info, 175 (syshandler_t) sys_ps_get_mem_info, 176 (syshandler_t) sys_ps_get_tasks, 177 (syshandler_t) sys_ps_get_task_info, 178 (syshandler_t) sys_ps_get_threads, 179 (syshandler_t) sys_ps_get_uptime, 180 (syshandler_t) sys_ps_get_load, 163 181 164 182 (syshandler_t) sys_ipc_connect_kbox -
kernel/generic/src/time/clock.c
r5ba201d r88dea9d 137 137 size_t missed_clock_ticks = CPU->missed_clock_ticks; 138 138 unsigned int i; 139 140 /* Account lost ticks to CPU usage */ 141 if (CPU->idle) { 142 ASSERT(missed_clock_ticks == 0); 143 CPU->idle_ticks++; 144 } else { 145 CPU->busy_ticks += missed_clock_ticks + 1; 146 } 147 CPU->idle = false; 139 148 140 149 /* -
uspace/Makefile
r5ba201d r88dea9d 46 46 app/tetris \ 47 47 app/trace \ 48 app/ps \ 49 app/top \ 50 app/uptime \ 51 app/dummy_load \ 48 52 srv/clip \ 49 53 srv/devmap \ -
uspace/lib/c/Makefile
r5ba201d r88dea9d 95 95 generic/vfs/canonify.c \ 96 96 generic/stacktrace.c \ 97 generic/arg_parse.c 97 generic/arg_parse.c \ 98 generic/ps.c \ 99 generic/cpuinfo.c \ 100 generic/meminfo.c \ 101 generic/load.c \ 102 generic/uptime.c 98 103 99 104 SOURCES = \
Note:
See TracChangeset
for help on using the changeset viewer.