MCPcopy Create free account
hub / github.com/HelenOS/helenos / task_get_accounting

Function task_get_accounting

kernel/generic/src/proc/task.c:497–526  ·  view source on GitHub ↗

Get accounting data of given task. * * Note that task lock of 'task' must be already held and interrupts must be * already disabled. * * @param task Pointer to the task. * @param ucycles Out pointer to sum of all user cycles. * @param kcycles Out pointer to sum of all kernel cycles. * */

Source from the content-addressed store, hash-verified

495 *
496 */
497void task_get_accounting(task_t *task, uint64_t *ucycles, uint64_t *kcycles)
498{
499 assert(interrupts_disabled());
500 assert(irq_spinlock_locked(&task->lock));
501
502 /* Accumulated values of task */
503 uint64_t uret = task->ucycles;
504 uint64_t kret = task->kcycles;
505
506 /* Current values of threads */
507 list_foreach(task->threads, th_link, thread_t, thread) {
508 irq_spinlock_lock(&thread->lock, false);
509
510 /* Process only counted threads */
511 if (!thread->uncounted) {
512 if (thread == THREAD) {
513 /* Update accounting of current thread */
514 thread_update_accounting(false);
515 }
516
517 uret += thread->ucycles;
518 kret += thread->kcycles;
519 }
520
521 irq_spinlock_unlock(&thread->lock, false);
522 }
523
524 *ucycles = uret;
525 *kcycles = kret;
526}
527
528static void task_kill_internal(task_t *task)
529{

Callers 4

run_testFunction · 0.85
run_benchFunction · 0.85
produce_stats_taskFunction · 0.85
task_printFunction · 0.85

Calls 5

irq_spinlock_lockedFunction · 0.85
irq_spinlock_lockFunction · 0.85
thread_update_accountingFunction · 0.85
irq_spinlock_unlockFunction · 0.85
interrupts_disabledFunction · 0.50

Tested by

no test coverage detected