Index: kernel/generic/include/ps/load.h
===================================================================
--- kernel/generic/include/ps/load.h	(revision 3a10e34b6c5c24ae1148df0041d9600c5fd9b764)
+++ kernel/generic/include/ps/load.h	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
@@ -37,4 +37,5 @@
 
 extern void kload_thread(void *);
+extern int sys_ps_get_load(size_t *user_load);
 
 #endif
Index: kernel/generic/include/syscall/syscall.h
===================================================================
--- kernel/generic/include/syscall/syscall.h	(revision 3a10e34b6c5c24ae1148df0041d9600c5fd9b764)
+++ kernel/generic/include/syscall/syscall.h	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
@@ -91,4 +91,5 @@
 	SYS_PS_GET_TASK_INFO,
 	SYS_PS_GET_THREADS,
+	SYS_PS_GET_LOAD,
 
 	SYS_IPC_CONNECT_KBOX,
Index: kernel/generic/src/ps/load.c
===================================================================
--- kernel/generic/src/ps/load.c	(revision 3a10e34b6c5c24ae1148df0041d9600c5fd9b764)
+++ kernel/generic/src/ps/load.c	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
@@ -40,4 +40,64 @@
 #include <ps/load.h>
 #include <arch.h>
+#include <proc/scheduler.h>
+#include <config.h>
+#include <arch/types.h>
+#include <time/clock.h>
+#include <syscall/copy.h>
+
+static size_t get_running_count(void);
+
+size_t avenrun[3];
+
+#define FSHIFT   11		/* nr of bits of precision */
+#define FIXED_1  (1<<FSHIFT)	/* 1.0 as fixed-point */
+#define LOAD_FREQ 5		/* 5 sec intervals */
+#define EXP_1  1884		/* 1/exp(5sec/1min) as fixed-point */
+#define EXP_5  2014		/* 1/exp(5sec/5min) */
+#define EXP_15 2037		/* 1/exp(5sec/15min) */
+
+#define CALC_LOAD(load,exp,n) \
+	load *= exp; \
+	load += n*(FIXED_1-exp); \
+	load >>= FSHIFT;
+
+static inline unsigned long calc_load(size_t load, size_t exp, size_t active)
+{
+	load *= exp;
+	load += active * (FIXED_1 - exp);
+	return load >> FSHIFT;
+}
+
+static inline void calc_load_global(void)
+{
+	size_t active;
+
+	active = get_running_count();
+	active = active > 0 ? active * FIXED_1 : 0;
+	avenrun[0] = calc_load(avenrun[0], EXP_1, active);
+	avenrun[1] = calc_load(avenrun[1], EXP_5, active);
+	avenrun[2] = calc_load(avenrun[2], EXP_15, active);
+}
+
+static size_t get_running_count(void)
+{
+	size_t i;
+	size_t result = 0;
+	ipl_t ipl;
+
+	/* run queues should not change during reading */
+	ipl = interrupts_disable();
+
+	for (i = 0; i < config.cpu_active; ++i) {
+		cpu_t *cpu = &cpus[i];
+		int j;
+		for (j = 0; j < RQ_COUNT; ++j) {
+			result += cpu->rq[j].n;
+		}
+	} 
+
+	interrupts_restore(ipl);
+	return result;
+}
 
 /** Load thread main function.
@@ -51,9 +111,19 @@
 	/* Noone will thread_join us */
 	thread_detach(THREAD);
+	avenrun[0] = 0;
+	avenrun[1] = 0;
+	avenrun[2] = 0;
 
 	while (true) {
-		printf("load thread alive\n");
-		thread_sleep(5);
+		calc_load_global();
+		printf("Computed loads: 0x%x 0x%x 0x%x\n", avenrun[0], avenrun[1], avenrun[2]);
+		thread_sleep(LOAD_FREQ);
 	}
+}
+
+int sys_ps_get_load(size_t *user_load)
+{
+	copy_to_uspace(user_load, avenrun, sizeof(avenrun));
+	return 0;
 }
 
Index: kernel/generic/src/syscall/syscall.c
===================================================================
--- kernel/generic/src/syscall/syscall.c	(revision 3a10e34b6c5c24ae1148df0041d9600c5fd9b764)
+++ kernel/generic/src/syscall/syscall.c	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
@@ -55,4 +55,5 @@
 #include <udebug/udebug.h>
 #include <ps/ps.h>
+#include <ps/load.h>
 
 /** Dispatch system call */
@@ -171,4 +172,5 @@
 	(syshandler_t) sys_ps_get_task_info,
 	(syshandler_t) sys_ps_get_threads,
+	(syshandler_t) sys_ps_get_load,
 	
 	(syshandler_t) sys_ipc_connect_kbox
Index: uspace/app/ps/ps.c
===================================================================
--- uspace/app/ps/ps.c	(revision 3a10e34b6c5c24ae1148df0041d9600c5fd9b764)
+++ uspace/app/ps/ps.c	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
@@ -42,4 +42,5 @@
 #include <stdlib.h>
 #include <malloc.h>
+#include <load.h>
 
 #include "func.h"
@@ -120,7 +121,17 @@
 }
 
+static void echo_load(void)
+{
+	size_t load[3];
+	load[0] = 0;
+	load[1] = 0;
+	load[2] = 0;
+	get_load(load);
+	printf("Current load: %d.%03d %d.%03d %d.%03d\n", load[0] >> 11, (load[0] & 0x7ff) / 2, load[1] >> 11, (load[1] & 0x7ff) / 2, load[2] >> 11, (load[2] & 0x7ff) / 2);
+}
+
 static void usage()
 {
-	printf("Usage: ps [-t pid]\n");
+	printf("Usage: ps [-t pid -l]\n");
 }
 
@@ -140,4 +151,12 @@
 			task_id_t taskid = strtol(*argv, NULL, 10);
 			list_threads(taskid);
+		} if (str_cmp(*argv, "-l") == 0) {
+			--argc; ++argv;
+			if (argc != 0) {
+				printf("Bad argument count!\n");
+				usage();
+				exit(1);
+			}
+			echo_load();
 		} else {
 			printf("Unknown argument %s!\n", *argv);
@@ -145,5 +164,4 @@
 			exit(1);
 		}
-
 	} else {
 		list_tasks();
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 3a10e34b6c5c24ae1148df0041d9600c5fd9b764)
+++ uspace/lib/c/Makefile	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
@@ -91,5 +91,6 @@
 	generic/vfs/canonify.c \
 	generic/stacktrace.c \
-	generic/ps.c
+	generic/ps.c \
+	generic/load.c
 
 SOURCES = \
Index: uspace/lib/c/generic/load.c
===================================================================
--- uspace/lib/c/generic/load.c	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
+++ uspace/lib/c/generic/load.c	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
@@ -0,0 +1,51 @@
+/*
+ * 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 libc
+ * @{
+ */
+/** @file
+ */
+
+#include <load.h>
+#include <libc.h>
+
+/** Get current system load
+ *
+ * @param load		Pointer where load will be stored.
+ *
+ * @return		EOK.
+ *
+ */
+int get_load(size_t *load)
+{
+	return __SYSCALL1(SYS_PS_GET_LOAD, (sysarg_t) load);
+}
+
+/** @}
+ */
Index: uspace/lib/c/include/load.h
===================================================================
--- uspace/lib/c/include/load.h	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
+++ uspace/lib/c/include/load.h	(revision 944f2cabb1486d36083818853bbff23141ff6e5e)
@@ -0,0 +1,46 @@
+/*
+ * 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 libc
+ * @{
+ */
+/** @file
+ */ 
+
+#ifndef LIBC_LOAD_H_
+#define LIBC_LOAD_H_
+
+#include <sys/types.h>
+#include <libarch/types.h>
+
+extern int get_load(size_t *load);
+
+#endif
+
+/** @}
+ */
