]> rtime.felk.cvut.cz Git - frescor/demo.git/commitdiff
Add a new program to generate CPU load
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 17 May 2010 16:41:45 +0000 (18:41 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 17 May 2010 16:41:45 +0000 (18:41 +0200)
Hackbench is too invasive.

build-no-frsh/utils [new symlink]
build/utils [new symlink]
src/utils/Makefile [new file with mode: 0644]
src/utils/Makefile.omk [new file with mode: 0644]
src/utils/loadcpu.c [new file with mode: 0644]

diff --git a/build-no-frsh/utils b/build-no-frsh/utils
new file mode 120000 (symlink)
index 0000000..9da3051
--- /dev/null
@@ -0,0 +1 @@
+../src/utils
\ No newline at end of file
diff --git a/build/utils b/build/utils
new file mode 120000 (symlink)
index 0000000..9da3051
--- /dev/null
@@ -0,0 +1 @@
+../src/utils
\ No newline at end of file
diff --git a/src/utils/Makefile b/src/utils/Makefile
new file mode 100644 (file)
index 0000000..b22a357
--- /dev/null
@@ -0,0 +1,14 @@
+# Generic directory or leaf node makefile for OCERA make framework
+
+ifndef MAKERULES_DIR
+MAKERULES_DIR := $(shell ( old_pwd="" ;  while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" = `pwd`  ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) )
+endif
+
+ifeq ($(MAKERULES_DIR),)
+all : default
+.DEFAULT::
+       @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n"
+else
+include $(MAKERULES_DIR)/Makefile.rules
+endif
+
diff --git a/src/utils/Makefile.omk b/src/utils/Makefile.omk
new file mode 100644 (file)
index 0000000..2e8bd34
--- /dev/null
@@ -0,0 +1,2 @@
+bin_PROGRAMS=loadcpu
+loadcpu_SOURCES=loadcpu.c
diff --git a/src/utils/loadcpu.c b/src/utils/loadcpu.c
new file mode 100644 (file)
index 0000000..0990fb5
--- /dev/null
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <unistd.h>
+
+volatile unsigned long long i = 200000000;
+int main(int argc, char *argv[])
+{
+       if (argc > 1)
+               sleep(strtol(argv[1], NULL, 10));
+       if (argc > 2)
+               printf("%s\n", argv[2]);
+       while (i > 0) i--;
+       return 0;
+}