Index: uspace/app/top/Makefile
===================================================================
--- uspace/app/top/Makefile	(revision 62550dcebaf6572f33fa63e95f98ecc3f61f4cec)
+++ uspace/app/top/Makefile	(revision dd6c71c380776720e701c2f1fcae52f96ff59542)
@@ -34,5 +34,6 @@
 	top.c \
 	screen.c \
-	input.c
+	input.c \
+	ps.c
 
 include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/top/ps.c
===================================================================
--- uspace/app/top/ps.c	(revision dd6c71c380776720e701c2f1fcae52f96ff59542)
+++ uspace/app/top/ps.c	(revision dd6c71c380776720e701c2f1fcae52f96ff59542)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2010 Stanislav Kozina
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup top
+ * @brief Task lister.
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include <stdio.h>
+#include <task.h>
+#include <thread.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <ps.h>
+#include "ps.h"
+
+#define TASK_COUNT 10
+#define THREAD_COUNT 50
+
+/** Thread states */
+const char *thread_states[] = {
+	"Invalid",
+	"Running",
+	"Sleeping",
+	"Ready",
+	"Entering",
+	"Exiting",
+	"Lingering"
+}; 
+
+unsigned int get_tasks(task_id_t **out_tasks)
+{
+	int 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);
+
+	while (result > task_count) {
+		task_count *= 2;
+		tasks = realloc(tasks, task_count * sizeof(task_id_t));
+		result = get_task_ids(tasks, sizeof(task_id_t) * task_count);
+	}
+
+	int i;
+	for (i = 0; i < result; ++i) {
+		task_info_t taskinfo;
+		get_task_info(tasks[i], &taskinfo);
+	}
+
+	*out_tasks = tasks;
+	return result;
+}
+
+thread_info_t *get_threads(task_id_t taskid)
+{
+	int thread_count = THREAD_COUNT;
+	thread_info_t *threads = malloc(thread_count * sizeof(thread_info_t));
+	int result = get_task_threads(taskid, threads, sizeof(thread_info_t) * thread_count);
+
+	while (result > thread_count) {
+		thread_count *= 2;
+		threads = realloc(threads, thread_count * sizeof(thread_info_t));
+		result = get_task_threads(taskid, threads, sizeof(thread_info_t) * thread_count);
+	}
+	
+	return threads;
+}
+
+/** @}
+ */
Index: uspace/app/top/ps.h
===================================================================
--- uspace/app/top/ps.h	(revision dd6c71c380776720e701c2f1fcae52f96ff59542)
+++ uspace/app/top/ps.h	(revision dd6c71c380776720e701c2f1fcae52f96ff59542)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2008 Stanislav Kozina
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup top
+ * @{
+ */
+
+#ifndef TOP_PS_H_
+#define TOP_PS_H_
+
+#include <task.h>
+#include <kernel/ps/taskinfo.h>
+
+extern const char *thread_states[];
+extern unsigned int get_tasks(task_id_t **out_tasks);
+extern thread_info_t *get_threads(task_id_t taskid);
+
+#endif
+
+/**
+ * @}
+ */
Index: uspace/app/top/screen.c
===================================================================
--- uspace/app/top/screen.c	(revision 62550dcebaf6572f33fa63e95f98ecc3f61f4cec)
+++ uspace/app/top/screen.c	(revision dd6c71c380776720e701c2f1fcae52f96ff59542)
@@ -38,4 +38,5 @@
 #include <io/console.h>
 #include <vfs/vfs.h>
+#include <load.h>
 #include "screen.h"
 #include "top.h"
@@ -73,9 +74,24 @@
 static inline void print_uptime(data_t *data)
 {
-	printf("up %4d days, %02d:%02d:%02d ", data->uptime_d, data->uptime_h,
+	printf("up %4d days, %02d:%02d:%02d, ", data->uptime_d, data->uptime_h,
 		data->uptime_m, data->uptime_s);
 }
 
-static int i = 0;
+static inline void print_load(data_t *data)
+{
+	puts("load avarage: ");
+	print_load_fragment(data->load[0], 2);
+	puts(" ");
+	print_load_fragment(data->load[1], 2);
+	puts(" ");
+	print_load_fragment(data->load[2], 2);
+}
+
+static inline void print_taskstat(data_t *data)
+{
+	puts("Tasks: ");
+	printf("%4u total", data->task_count);
+}
+
 void print_data(data_t *data)
 {
@@ -85,6 +101,8 @@
 	print_time(data);
 	print_uptime(data);
-	puts(" ... \n");
-	printf("A dalsi radek topu - jiz po %dte", ++i);
+	print_load(data);
+	puts("\n");
+	print_taskstat(data);
+	puts("\n");
 	fflush(stdout);
 }
Index: uspace/app/top/top.c
===================================================================
--- uspace/app/top/top.c	(revision 62550dcebaf6572f33fa63e95f98ecc3f61f4cec)
+++ uspace/app/top/top.c	(revision dd6c71c380776720e701c2f1fcae52f96ff59542)
@@ -47,4 +47,5 @@
 #include "input.h"
 #include "top.h"
+#include "ps.h"
 
 #define UPDATE_INTERVAL 1
@@ -76,4 +77,7 @@
 	/* Read load */
 	get_load(target->load);
+
+	/* Read task ids */
+	target->task_count = get_tasks(&target->tasks);
 }
 
@@ -111,4 +115,5 @@
 	}
 
+	free(new_data.tasks);
 	puts("\n\n");
 	fflush(stdout);
Index: uspace/app/top/top.h
===================================================================
--- uspace/app/top/top.h	(revision 62550dcebaf6572f33fa63e95f98ecc3f61f4cec)
+++ uspace/app/top/top.h	(revision dd6c71c380776720e701c2f1fcae52f96ff59542)
@@ -34,4 +34,6 @@
 #define TOP_TOP_H_
 
+#include <task.h>
+
 typedef struct {
 	unsigned int hours;
@@ -45,4 +47,7 @@
 
 	unsigned long load[3];
+
+	task_id_t *tasks;
+	unsigned int task_count;
 } data_t;
 
Index: uspace/app/uptime/uptime.c
===================================================================
--- uspace/app/uptime/uptime.c	(revision 62550dcebaf6572f33fa63e95f98ecc3f61f4cec)
+++ uspace/app/uptime/uptime.c	(revision dd6c71c380776720e701c2f1fcae52f96ff59542)
@@ -44,7 +44,4 @@
 #define MINUTE 60
 
-#define ECHOLOAD1(x) ((x) >> 11)
-#define ECHOLOAD2(x) (((x) & 0x7ff) / 2)
-
 int main(int argc, char *argv[])
 {
