Index: kernel/generic/include/proc/task.h
===================================================================
--- kernel/generic/include/proc/task.h	(revision 34bba0e9424b4550e78c0742e0ca374742498082)
+++ kernel/generic/include/proc/task.h	(revision a2a00e8d4f4059d97c6514c8276189ab85ff03a8)
@@ -123,4 +123,6 @@
 	/** Accumulated accounting. */
 	uint64_t cycles;
+	uint64_t ucycles;
+	uint64_t kcycles;
 } task_t;
 
@@ -134,5 +136,5 @@
 extern task_t *task_find_by_id(task_id_t id);
 extern int task_kill(task_id_t id);
-extern uint64_t task_get_accounting(task_t *t);
+extern uint64_t task_get_accounting(task_t *t, uint64_t *ucycles, uint64_t *kcycles);
 extern void task_print_list(void);
 
Index: kernel/generic/include/proc/thread.h
===================================================================
--- kernel/generic/include/proc/thread.h	(revision 34bba0e9424b4550e78c0742e0ca374742498082)
+++ kernel/generic/include/proc/thread.h	(revision a2a00e8d4f4059d97c6514c8276189ab85ff03a8)
@@ -175,4 +175,6 @@
 	/** Thread accounting. */
 	uint64_t cycles;
+	uint64_t ucycles;
+	uint64_t kcycles;
 	/** Last sampled cycle. */
 	uint64_t last_cycle;
@@ -237,5 +239,5 @@
 extern void thread_print_list(void);
 extern void thread_destroy(thread_t *);
-extern void thread_update_accounting(void);
+extern void thread_update_accounting(bool);
 extern bool thread_exists(thread_t *);
 
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision 34bba0e9424b4550e78c0742e0ca374742498082)
+++ kernel/generic/src/console/cmd.c	(revision a2a00e8d4f4059d97c6514c8276189ab85ff03a8)
@@ -1027,5 +1027,6 @@
 	ipl_t ipl = interrupts_disable();
 	spinlock_lock(&TASK->lock);
-	uint64_t t0 = task_get_accounting(TASK);
+	uint64_t ucycles, kcycles;
+	uint64_t t0 = task_get_accounting(TASK, &ucycles, &kcycles);
 	spinlock_unlock(&TASK->lock);
 	interrupts_restore(ipl);
@@ -1038,5 +1039,5 @@
 	ipl = interrupts_disable();
 	spinlock_lock(&TASK->lock);
-	uint64_t dt = task_get_accounting(TASK) - t0;
+	uint64_t dt = task_get_accounting(TASK, &ucycles, &kcycles) - t0;
 	spinlock_unlock(&TASK->lock);
 	interrupts_restore(ipl);
@@ -1080,5 +1081,6 @@
 		ipl_t ipl = interrupts_disable();
 		spinlock_lock(&TASK->lock);
-		uint64_t t0 = task_get_accounting(TASK);
+		uint64_t ucycles, kcycles;
+		uint64_t t0 = task_get_accounting(TASK, &ucycles, &kcycles);
 		spinlock_unlock(&TASK->lock);
 		interrupts_restore(ipl);
@@ -1091,5 +1093,5 @@
 		ipl = interrupts_disable();
 		spinlock_lock(&TASK->lock);
-		uint64_t dt = task_get_accounting(TASK) - t0;
+		uint64_t dt = task_get_accounting(TASK, &ucycles, &kcycles) - t0;
 		spinlock_unlock(&TASK->lock);
 		interrupts_restore(ipl);
Index: kernel/generic/src/interrupt/interrupt.c
===================================================================
--- kernel/generic/src/interrupt/interrupt.c	(revision 34bba0e9424b4550e78c0742e0ca374742498082)
+++ kernel/generic/src/interrupt/interrupt.c	(revision a2a00e8d4f4059d97c6514c8276189ab85ff03a8)
@@ -51,4 +51,5 @@
 #include <print.h>
 #include <symtab.h>
+#include <proc/thread.h>
 
 static struct {
@@ -90,4 +91,8 @@
 {
 	ASSERT(n < IVT_ITEMS);
+
+	/* Account user cycles */
+	if (THREAD)
+		thread_update_accounting(true);
 
 #ifdef CONFIG_UDEBUG
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision 34bba0e9424b4550e78c0742e0ca374742498082)
+++ kernel/generic/src/proc/scheduler.c	(revision a2a00e8d4f4059d97c6514c8276189ab85ff03a8)
@@ -315,4 +315,5 @@
 		/* Update thread accounting */
 		THREAD->cycles += get_cycle() - THREAD->last_cycle;
+		THREAD->kcycles += get_cycle() - THREAD->last_cycle;
 		
 #ifndef CONFIG_FPU_LAZY
Index: kernel/generic/src/proc/task.c
===================================================================
--- kernel/generic/src/proc/task.c	(revision 34bba0e9424b4550e78c0742e0ca374742498082)
+++ kernel/generic/src/proc/task.c	(revision a2a00e8d4f4059d97c6514c8276189ab85ff03a8)
@@ -185,4 +185,6 @@
 	ta->capabilities = 0;
 	ta->cycles = 0;
+	ta->ucycles = 0;
+	ta->kcycles = 0;
 
 #ifdef CONFIG_UDEBUG
@@ -317,12 +319,13 @@
  *
  * @param t		Pointer to thread.
- *
- * @return		Number of cycles used by the task and all its threads
- * 			so far.
- */
-uint64_t task_get_accounting(task_t *t)
-{
-	/* Accumulated value of task */
+ * @param ucycles	Out pointer to sum of all user cycles.
+ * @param kcycles	Out pointer to sum of all kernel cycles.
+ */
+uint64_t task_get_accounting(task_t *t, uint64_t *ucycles, uint64_t *kcycles)
+{
+	/* Accumulated values of task */
 	uint64_t ret = t->cycles;
+	uint64_t uret = t->ucycles;
+	uint64_t kret = t->kcycles;
 	
 	/* Current values of threads */
@@ -336,6 +339,8 @@
 			if (thr == THREAD) {
 				/* Update accounting of current thread */
-				thread_update_accounting();
+				thread_update_accounting(false);
 			} 
+			uret += thr->ucycles;
+			kret += thr->kcycles;
 			ret += thr->cycles;
 		}
@@ -343,4 +348,7 @@
 	}
 	
+	*ucycles = uret;
+	*kcycles = kret;
+
 	return ret;
 }
@@ -410,17 +418,24 @@
 			
 	uint64_t cycles;
-	char suffix;
-	order(task_get_accounting(t), &cycles, &suffix);
+	uint64_t ucycles;
+	uint64_t kcycles;
+	char suffix, usuffix, ksuffix;
+	cycles = task_get_accounting(t, &ucycles, &kcycles);
+	order(cycles, &cycles, &suffix);
+	order(ucycles, &ucycles, &usuffix);
+	order(kcycles, &kcycles, &ksuffix);
 
 #ifdef __32_BITS__	
-	printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %10p %10p %9" PRIu64
-	    "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles,
-	    suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls));
+	printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %10p %10p %9" PRIu64 "%c %9" PRIu64 "%c %9"
+		PRIu64 "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, suffix,
+		ucycles, usuffix, kcycles, ksuffix, atomic_get(&t->refcount),
+		atomic_get(&t->active_calls));
 #endif
 
 #ifdef __64_BITS__
-	printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %18p %18p %9" PRIu64
-	    "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles,
-	    suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls));
+	printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %18p %18p %9" PRIu64 "%c %9" PRIu64 "%c %9"
+		PRIu64 "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, suffix,
+		ucycles, usuffix, kcycles, ksuffix, atomic_get(&t->refcount),
+		atomic_get(&t->active_calls));
 #endif
 
@@ -445,15 +460,15 @@
 
 #ifdef __32_BITS__	
-	printf("taskid name         ctx address    as         "
-	    "cycles     threads calls  callee\n");
-	printf("------ ------------ --- ---------- ---------- "
-	    "---------- ------- ------ ------>\n");
+	printf("taskid name         ctx address    as        "
+	    " cycles     ucycles    kcycles    threads calls  callee\n");
+	printf("------ ------------ --- ---------- ----------"
+	    " ---------- ---------- ---------- ------- ------ ------>\n");
 #endif
 
 #ifdef __64_BITS__
-	printf("taskid name         ctx address            as                 "
-	    "cycles     threads calls  callee\n");
-	printf("------ ------------ --- ------------------ ------------------ "
-	    "---------- ------- ------ ------>\n");
+	printf("taskid name         ctx address            as                "
+	    " cycles     ucycles    kcycles    threads calls  callee\n");
+	printf("------ ------------ --- ------------------ ------------------"
+	    " ---------- ---------- ---------- ---------- ------- ------ ------>\n");
 #endif
 
Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision 34bba0e9424b4550e78c0742e0ca374742498082)
+++ kernel/generic/src/proc/thread.c	(revision a2a00e8d4f4059d97c6514c8276189ab85ff03a8)
@@ -132,11 +132,18 @@
 	spinlock_lock(&THREAD->lock);
 	if (!THREAD->uncounted) {
-		thread_update_accounting();
+		thread_update_accounting(true);
 		uint64_t cycles = THREAD->cycles;
 		THREAD->cycles = 0;
+		uint64_t ucycles = THREAD->ucycles;
+		THREAD->ucycles = 0;
+		uint64_t kcycles = THREAD->kcycles;
+		THREAD->kcycles = 0;
+
 		spinlock_unlock(&THREAD->lock);
 		
 		spinlock_lock(&TASK->lock);
 		TASK->cycles += cycles;
+		TASK->ucycles += ucycles;
+		TASK->kcycles += kcycles;
 		spinlock_unlock(&TASK->lock);
 	} else
@@ -324,4 +331,6 @@
 	t->ticks = -1;
 	t->cycles = 0;
+	t->ucycles = 0;
+	t->kcycles = 0;
 	t->uncounted = uncounted;
 	t->priority = -1;		/* start in rq[0] */
@@ -614,18 +623,20 @@
 	thread_t *t = avltree_get_instance(node, thread_t, threads_tree_node);
 	
-	uint64_t cycles;
-	char suffix;
+	uint64_t cycles, ucycles, kcycles;
+	char suffix, usuffix, ksuffix;
 	order(t->cycles, &cycles, &suffix);
+	order(t->ucycles, &ucycles, &usuffix);
+	order(t->kcycles, &kcycles, &ksuffix);
 
 #ifdef __32_BITS__
-	printf("%-6" PRIu64" %-10s %10p %-8s %10p %-3" PRIu32 " %10p %10p %9" PRIu64 "%c ",
+	printf("%-6" PRIu64" %-10s %10p %-8s %10p %-3" PRIu32 " %10p %10p %9" PRIu64 "%c %9" PRIu64 "%c %9" PRIu64 "%c ",
 	    t->tid, t->name, t, thread_states[t->state], t->task,
-    	t->task->context, t->thread_code, t->kstack, cycles, suffix);
+    	t->task->context, t->thread_code, t->kstack, cycles, suffix, ucycles, usuffix, kcycles, ksuffix);
 #endif
 
 #ifdef __64_BITS__
-	printf("%-6" PRIu64" %-10s %18p %-8s %18p %-3" PRIu32 " %18p %18p %9" PRIu64 "%c ",
+	printf("%-6" PRIu64" %-10s %18p %-8s %18p %-3" PRIu32 " %18p %18p %9" PRIu64 "%c %9" PRIu64 "%c %9" PRIu64 "%c ",
 	    t->tid, t->name, t, thread_states[t->state], t->task,
-    	t->task->context, t->thread_code, t->kstack, cycles, suffix);
+    	t->task->context, t->thread_code, t->kstack, cycles, suffix, ucycles, usuffix, kcycles, ksuffix);
 #endif
 			
@@ -661,8 +672,8 @@
 #ifdef __32_BITS__	
 	printf("tid    name       address    state    task       "
-		"ctx code       stack      cycles     cpu  "
+		"ctx code       stack      cycles     ucycles    kcycles    cpu  "
 		"waitqueue\n");
 	printf("------ ---------- ---------- -------- ---------- "
-		"--- ---------- ---------- ---------- ---- "
+		"--- ---------- ---------- ---------- ---------- ---------- ---- "
 		"----------\n");
 #endif
@@ -670,8 +681,8 @@
 #ifdef __64_BITS__
 	printf("tid    name       address            state    task               "
-		"ctx code               stack              cycles     cpu  "
+		"ctx code               stack              cycles     ucycles    kcycles    cpu  "
 		"waitqueue\n");
 	printf("------ ---------- ------------------ -------- ------------------ "
-		"--- ------------------ ------------------ ---------- ---- "
+		"--- ------------------ ------------------ ---------- ---------- ---------- ---- "
 		"------------------\n");
 #endif
@@ -706,9 +717,15 @@
  * interrupts must be already disabled.
  *
- */
-void thread_update_accounting(void)
+ * @param user	True to update user accounting, false for kernel.
+ */
+void thread_update_accounting(bool user)
 {
 	uint64_t time = get_cycle();
 	THREAD->cycles += time - THREAD->last_cycle;
+	if (user) {
+		THREAD->ucycles += time - THREAD->last_cycle;
+	} else {
+		THREAD->kcycles += time - THREAD->last_cycle;
+	}
 	THREAD->last_cycle = time;
 }
Index: kernel/generic/src/ps/ps.c
===================================================================
--- kernel/generic/src/ps/ps.c	(revision 34bba0e9424b4550e78c0742e0ca374742498082)
+++ kernel/generic/src/ps/ps.c	(revision a2a00e8d4f4059d97c6514c8276189ab85ff03a8)
@@ -132,5 +132,7 @@
 	copy_to_uspace(uspace_info->name, t->name, sizeof(t->name));
 
-	uint64_t cycles = task_get_accounting(t);
+	uint64_t ucycles;
+	uint64_t kcycles;
+	uint64_t cycles = task_get_accounting(t, &ucycles, &kcycles);
 	copy_to_uspace(&uspace_info->cycles, &cycles, sizeof(cycles));
 
