Update accounting of current thread. * * Note that thread_lock on THREAD must be already held and * interrupts must be already disabled. * * @param user True to update user accounting, false for kernel. * */
| 831 | * |
| 832 | */ |
| 833 | void thread_update_accounting(bool user) |
| 834 | { |
| 835 | uint64_t time = get_cycle(); |
| 836 | |
| 837 | assert(interrupts_disabled()); |
| 838 | assert(irq_spinlock_locked(&THREAD->lock)); |
| 839 | |
| 840 | if (user) |
| 841 | THREAD->ucycles += time - THREAD->last_cycle; |
| 842 | else |
| 843 | THREAD->kcycles += time - THREAD->last_cycle; |
| 844 | |
| 845 | THREAD->last_cycle = time; |
| 846 | } |
| 847 | |
| 848 | /** Find thread structure corresponding to thread ID. |
| 849 | * |
no test coverage detected