Index: kernel/generic/src/proc/task.c
===================================================================
--- kernel/generic/src/proc/task.c	(revision f88fcbec8f4c20dfefb67f4a7237bfc980de7a2d)
+++ kernel/generic/src/proc/task.c	(revision 0313ff0ebb436deb6a48b67d17b944f3fc79f731)
@@ -120,4 +120,5 @@
 	ta->capabilities = 0;
 	ta->accept_new_threads = true;
+	ta->cycles = 0;
 	
 	ipc_answerbox_init(&ta->answerbox);
@@ -267,4 +268,34 @@
 }
 
+/** Get accounting data of given task.
+ *
+ * Note that task_lock on @t must be already held and
+ * interrupts must be already disabled.
+ *
+ * @param t Pointer to thread.
+ *
+ */
+uint64_t task_get_accounting(task_t *t)
+{
+	/* Accumulated value of task */
+	uint64_t ret = t->cycles;
+	
+	/* Current values of threads */
+	link_t *cur;
+	for (cur = t->th_head.next; cur != &t->th_head; cur = cur->next) {
+		thread_t *thr = list_get_instance(cur, thread_t, th_link);
+		
+		spinlock_lock(&thr->lock);
+		
+		if (thr == THREAD) /* Update accounting of current thread */
+			thread_update_accounting(); 
+		ret += thr->cycles;
+		
+		spinlock_unlock(&thr->lock);
+	}
+	
+	return ret;
+}
+
 /** Kill task.
  *
@@ -345,6 +376,6 @@
 	spinlock_lock(&tasks_lock);
 	
-	printf("taskid name       ctx address    as         active calls callee\n");
-	printf("------ ---------- --- ---------- ---------- ------------ ------>\n");
+	printf("taskid name       ctx address    as         cycles     threads calls  callee\n");
+	printf("------ ---------- --- ---------- ---------- ---------- ------- ------ ------>\n");
 
 	for (cur = tasks_btree.leaf_head.next; cur != &tasks_btree.leaf_head; cur = cur->next) {
@@ -360,5 +391,21 @@
 		
 			spinlock_lock(&t->lock);
-			printf("%-6lld %-10s %-3ld %#10zx %#10zx %12zd", t->taskid, t->name, t->context, t, t->as, atomic_get(&t->active_calls));
+			
+			uint64_t cycles = task_get_accounting(t);
+			char suffix;
+			
+			if (cycles > 1000000000000000000LL) {
+				cycles = cycles / 1000000000000000000LL;
+				suffix = 'E';
+			} else if (cycles > 1000000000000LL) {
+				cycles = cycles / 1000000000000LL;
+				suffix = 'T';
+			} else if (cycles > 1000000LL) {
+				cycles = cycles / 1000000LL;
+				suffix = 'M';
+			} else 
+				suffix = ' ';
+			
+			printf("%-6lld %-10s %-3ld %#10zx %#10zx %9llu%c %7zd %6zd", t->taskid, t->name, t->context, t, t->as, cycles, suffix, t->refcount, atomic_get(&t->active_calls));
 			for (j = 0; j < IPC_MAX_PHONES; j++) {
 				if (t->phones[j].callee)
@@ -366,4 +413,5 @@
 			}
 			printf("\n");
+			
 			spinlock_unlock(&t->lock);
 		}
Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision f88fcbec8f4c20dfefb67f4a7237bfc980de7a2d)
+++ kernel/generic/src/proc/thread.c	(revision 0313ff0ebb436deb6a48b67d17b944f3fc79f731)
@@ -114,9 +114,25 @@
 	THREAD->last_cycle = get_cycle();
 
-	/* this is where each thread wakes up after its creation */
+	/* This is where each thread wakes up after its creation */
 	spinlock_unlock(&THREAD->lock);
 	interrupts_enable();
 
 	f(arg);
+	
+	/* Accumulate accounting to the task */
+	ipl_t ipl = interrupts_disable();
+	
+	spinlock_lock(&THREAD->lock);
+	thread_update_accounting();
+	uint64_t cycles = THREAD->cycles;
+	THREAD->cycles = 0;
+	spinlock_unlock(&THREAD->lock);
+	
+	spinlock_lock(&TASK->lock);
+	TASK->cycles += cycles;
+	spinlock_unlock(&TASK->lock);
+	
+	interrupts_restore(ipl);
+	
 	thread_exit();
 	/* not reached */
@@ -534,5 +550,5 @@
 	spinlock_lock(&threads_lock);
 	
-	printf("tid    name       address    state    task       ctx code       stack      cycles     cpu  kst        wq\n");
+	printf("tid    name       address    state    task       ctx code       stack      cycles     cpu  kstack     waitqueue\n");
 	printf("------ ---------- ---------- -------- ---------- --- ---------- ---------- ---------- ---- ---------- ----------\n");
 
@@ -604,6 +620,4 @@
  * interrupts must be already disabled.
  *
- * @param t Pointer to thread.
- *
  */
 void thread_update_accounting(void)
