Index: uspace/app/ps/ps.c
===================================================================
--- uspace/app/ps/ps.c	(revision faf38b24fb042fe9f1d90d5bb4cc3c9364782df0)
+++ uspace/app/ps/ps.c	(revision 638927aaf96314b3f36042b364dd1bba880197ba)
@@ -97,7 +97,7 @@
 static void list_threads(task_id_t taskid)
 {
-	int thread_count = THREAD_COUNT;
+	size_t thread_count = THREAD_COUNT;
 	thread_info_t *threads = malloc(thread_count * sizeof(thread_info_t));
-	int result = get_task_threads(threads, sizeof(thread_info_t) * thread_count);
+	size_t result = get_task_threads(threads, sizeof(thread_info_t) * thread_count);
 
 	while (result > thread_count) {
@@ -112,5 +112,5 @@
 	}
 
-	int i;
+	size_t i;
 	printf("    ID    State  CPU   Prio    [k]uCycles    [k]kcycles   Cycle fault\n");
 	for (i = 0; i < result; ++i) {
Index: uspace/app/top/ps.c
===================================================================
--- uspace/app/top/ps.c	(revision faf38b24fb042fe9f1d90d5bb4cc3c9364782df0)
+++ uspace/app/top/ps.c	(revision 638927aaf96314b3f36042b364dd1bba880197ba)
@@ -58,9 +58,9 @@
 }; 
 
-unsigned int get_tasks(task_info_t **out_infos)
+size_t get_tasks(task_info_t **out_infos)
 {
-	int task_count = TASK_COUNT;
+	size_t task_count = TASK_COUNT;
 	task_id_t *tasks = malloc(task_count * sizeof(task_id_t));
-	int result = get_task_ids(tasks, sizeof(task_id_t) * task_count);
+	size_t result = get_task_ids(tasks, sizeof(task_id_t) * task_count);
 
 	while (result > task_count) {
@@ -70,5 +70,5 @@
 	}
 
-	int i;
+	size_t i;
 	task_info_t *taskinfos = malloc(result * sizeof(task_info_t));
 	for (i = 0; i < result; ++i) {
@@ -82,9 +82,9 @@
 }
 
-thread_info_t *get_threads(task_id_t taskid)
+size_t get_threads(thread_info_t **thread_infos)
 {
-	int thread_count = THREAD_COUNT;
+	size_t thread_count = THREAD_COUNT;
 	thread_info_t *threads = malloc(thread_count * sizeof(thread_info_t));
-	int result = get_task_threads(threads, sizeof(thread_info_t) * thread_count);
+	size_t result = get_task_threads(threads, sizeof(thread_info_t) * thread_count);
 
 	while (result > thread_count) {
@@ -94,5 +94,6 @@
 	}
 	
-	return threads;
+	*thread_infos = threads;
+	return result;
 }
 
Index: uspace/app/top/ps.h
===================================================================
--- uspace/app/top/ps.h	(revision faf38b24fb042fe9f1d90d5bb4cc3c9364782df0)
+++ uspace/app/top/ps.h	(revision 638927aaf96314b3f36042b364dd1bba880197ba)
@@ -39,6 +39,6 @@
 
 extern const char *thread_states[];
-extern unsigned int get_tasks(task_info_t **out_infos);
-extern thread_info_t *get_threads(task_id_t taskid);
+extern size_t get_tasks(task_info_t **out_infos);
+extern size_t get_threads(thread_info_t **thread_infos);
 extern unsigned int get_cpu_infos(uspace_cpu_info_t **out_infos);
 
Index: uspace/app/top/screen.c
===================================================================
--- uspace/app/top/screen.c	(revision faf38b24fb042fe9f1d90d5bb4cc3c9364782df0)
+++ uspace/app/top/screen.c	(revision 638927aaf96314b3f36042b364dd1bba880197ba)
@@ -119,4 +119,36 @@
 }
 
+static inline void print_threadstat(data_t *data)
+{
+	size_t sleeping = 0;
+	size_t running = 0;
+	size_t invalid = 0;
+	size_t other = 0;
+	size_t total = 0;
+	size_t i;
+	for (i = 0; i < data->thread_count; ++i) {
+		++total;
+		switch (data->thread_infos[i].state) {
+			case Invalid:
+			case Lingering:
+				++invalid;
+				break;
+			case Running:
+			case Ready:
+				++running;
+				break;
+			case Sleeping:
+				++sleeping;
+				break;
+			case Entering:
+			case Exiting:
+				++other;
+				break;
+		}
+	}
+	printf("Threads: %5u total, %5u running, %5u sleeping, %5u invalid, %5u other",
+		total, running, sleeping, invalid, other);
+}
+
 static inline void print_cpuinfo(data_t *data)
 {
@@ -197,4 +229,7 @@
 	puts("\n");
 	++up_rows;
+	print_threadstat(data);
+	puts("\n");
+	++up_rows;
 	print_cpuinfo(data);
 	print_meminfo(data);
Index: uspace/app/top/top.c
===================================================================
--- uspace/app/top/top.c	(revision faf38b24fb042fe9f1d90d5bb4cc3c9364782df0)
+++ uspace/app/top/top.c	(revision 638927aaf96314b3f36042b364dd1bba880197ba)
@@ -44,4 +44,5 @@
 #include <load.h>
 #include <ps.h>
+#include <arch/barrier.h>
 #include "screen.h"
 #include "input.h"
@@ -82,4 +83,7 @@
 	/* Read task ids */
 	target->task_count = get_tasks(&target->taskinfos);
+
+	/* Read all threads */
+	target->thread_count = get_threads(&target->thread_infos);
 
 	/* Read cpu infos */
@@ -144,4 +148,7 @@
 	}
 
+	/* Wait until coprocessor finishes its work */
+	write_barrier();
+
 	/* And free temporary structures */
 	free(ucycles_diff);
@@ -152,4 +159,5 @@
 {
 	free(target->taskinfos);
+	free(target->thread_infos);
 	free(target->cpus);
 	free(target->cpu_perc);
Index: uspace/app/top/top.h
===================================================================
--- uspace/app/top/top.h	(revision faf38b24fb042fe9f1d90d5bb4cc3c9364782df0)
+++ uspace/app/top/top.h	(revision 638927aaf96314b3f36042b364dd1bba880197ba)
@@ -61,7 +61,10 @@
 	unsigned long load[3];
 
-	unsigned int task_count;
+	size_t task_count;
 	task_info_t *taskinfos;
 	task_perc_t *task_perc;
+
+	size_t thread_count;
+	thread_info_t *thread_infos;
 
 	unsigned int cpu_count;
