Index: orxonox/trunk/src/Makefile.am
===================================================================
--- orxonox/trunk/src/Makefile.am	(revision 4130)
+++ orxonox/trunk/src/Makefile.am	(revision 4131)
@@ -22,4 +22,5 @@
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/animation
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/common
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/subprojects
 
 
@@ -88,5 +89,6 @@
 		 lib/xmlparser/tinystr.cc \
 		 lib/xmlparser/tinyxmlerror.cc \
-		 lib/xmlparser/tinyxmlparser.cc 
+		 lib/xmlparser/tinyxmlparser.cc \
+		 subprojects/benchmark.cc
 
 noinst_HEADERS = orxonox.h \
@@ -160,5 +162,6 @@
 	         lib/gui/gui/gui_banner.h \
 	         lib/gui/gui/gui_keys.h \
-	         lib/gui/gui/gui_update.h
+	         lib/gui/gui/gui_update.h \
+		 subprojects/benchmark.h
 
 libORXgui_a_CPPFLAGS=$(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS)
Index: orxonox/trunk/src/Makefile.in
===================================================================
--- orxonox/trunk/src/Makefile.in	(revision 4130)
+++ orxonox/trunk/src/Makefile.in	(revision 4131)
@@ -90,5 +90,5 @@
 	vector.$(OBJEXT) curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT) \
 	tinyxml.$(OBJEXT) tinystr.$(OBJEXT) tinyxmlerror.$(OBJEXT) \
-	tinyxmlparser.$(OBJEXT)
+	tinyxmlparser.$(OBJEXT) benchmark.$(OBJEXT)
 orxonox_OBJECTS = $(am_orxonox_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -99,5 +99,6 @@
 @AMDEP_TRUE@	./$(DEPDIR)/animation_player.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/array.Po ./$(DEPDIR)/base_entity.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/base_object.Po ./$(DEPDIR)/camera.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/base_object.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/benchmark.Po ./$(DEPDIR)/camera.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/campaign.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/character_attributes.Po \
@@ -271,5 +272,5 @@
 target_vendor = @target_vendor@
 MAINSRCDIR = .
-AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/graphics/particles -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/gui/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common
+AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/graphics/particles -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/gui/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common -I$(MAINSRCDIR)/subprojects
 noinst_LIBRARIES = libORXgui.a
 orxonox_DEPENDENCIES = libORXgui.a
@@ -330,5 +331,6 @@
 		 lib/xmlparser/tinystr.cc \
 		 lib/xmlparser/tinyxmlerror.cc \
-		 lib/xmlparser/tinyxmlparser.cc 
+		 lib/xmlparser/tinyxmlparser.cc \
+		 subprojects/benchmark.cc
 
 noinst_HEADERS = orxonox.h \
@@ -402,5 +404,6 @@
 	         lib/gui/gui/gui_banner.h \
 	         lib/gui/gui/gui_keys.h \
-	         lib/gui/gui/gui_update.h
+	         lib/gui/gui/gui_update.h \
+		 subprojects/benchmark.h
 
 libORXgui_a_CPPFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS)
@@ -510,4 +513,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_entity.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_object.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/campaign.Po@am__quote@
@@ -1513,4 +1517,20 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o tinyxmlparser.obj `if test -f 'lib/xmlparser/tinyxmlparser.cc'; then $(CYGPATH_W) 'lib/xmlparser/tinyxmlparser.cc'; else $(CYGPATH_W) '$(srcdir)/lib/xmlparser/tinyxmlparser.cc'; fi`
+
+benchmark.o: subprojects/benchmark.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT benchmark.o -MD -MP -MF "$(DEPDIR)/benchmark.Tpo" -c -o benchmark.o `test -f 'subprojects/benchmark.cc' || echo '$(srcdir)/'`subprojects/benchmark.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/benchmark.Tpo" "$(DEPDIR)/benchmark.Po"; else rm -f "$(DEPDIR)/benchmark.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='subprojects/benchmark.cc' object='benchmark.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/benchmark.Po' tmpdepfile='$(DEPDIR)/benchmark.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o benchmark.o `test -f 'subprojects/benchmark.cc' || echo '$(srcdir)/'`subprojects/benchmark.cc
+
+benchmark.obj: subprojects/benchmark.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT benchmark.obj -MD -MP -MF "$(DEPDIR)/benchmark.Tpo" -c -o benchmark.obj `if test -f 'subprojects/benchmark.cc'; then $(CYGPATH_W) 'subprojects/benchmark.cc'; else $(CYGPATH_W) '$(srcdir)/subprojects/benchmark.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/benchmark.Tpo" "$(DEPDIR)/benchmark.Po"; else rm -f "$(DEPDIR)/benchmark.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='subprojects/benchmark.cc' object='benchmark.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/benchmark.Po' tmpdepfile='$(DEPDIR)/benchmark.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o benchmark.obj `if test -f 'subprojects/benchmark.cc'; then $(CYGPATH_W) 'subprojects/benchmark.cc'; else $(CYGPATH_W) '$(srcdir)/subprojects/benchmark.cc'; fi`
 uninstall-info-am:
 
@@ -1636,5 +1656,5 @@
 
 distdir: $(DISTFILES)
-	$(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/graphics/particles $(distdir)/lib/gui/gui $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/util $(distdir)/util/animation $(distdir)/util/common $(distdir)/world_entities
+	$(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/graphics/particles $(distdir)/lib/gui/gui $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/subprojects $(distdir)/util $(distdir)/util/animation $(distdir)/util/common $(distdir)/world_entities
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
Index: orxonox/trunk/src/orxonox.cc
===================================================================
--- orxonox/trunk/src/orxonox.cc	(revision 4130)
+++ orxonox/trunk/src/orxonox.cc	(revision 4131)
@@ -38,4 +38,5 @@
 #include "text_engine.h"
 #include "factory.h"
+#include "benchmark.h"
 
 #include <string.h>
@@ -410,446 +411,2 @@
   
 }
-
-#if defined __linux__ 
-
-#include "list.h"
-#include "world_entity.h"
-#include "vector.h"
-#include "player.h"
-#include "base_object.h"
-
-#include <asm/msr.h>
-#include <linux/timex.h>
-
-
-#define LIST_MAX 1000
-#define VECTOR_MAX 1000000
-#define ITERATIONS 10000
-
-
-int startBenchmarks()
-{
-
-  printf("===========================================================\n");
-  printf("=                      BENCHMARKS                         =\n");
-  printf("===========================================================\n");
-  printf(" the author is not paying any attention to cacheing effects\n");
-  printf(" of the CPU.\n\n");
-  printf("[title]\t\t\t\t\t     [cycles]\t[loops]\n\n");
-  //  printf("------------------------------------------------------------\n\n");
-
-  // first measure the time overhead:
-  unsigned long ini, end, dt, tmp;
-  rdtscl(ini); rdtscl(end);
-  dt = end - ini;
-
-  int type = -1; 
-  /* type   -1 == all 
-     type    0 == framework
-     type    1 == vector
-     type    2 == quaternion
-     type    3 == lists
-  */
-  if(type == 0 || type == -1)
-    {
-      /* framework test*/
-      
-      printf("Generating Objects:\t\t\t\t\t%i\n", ITERATIONS);
-      /* ************WorldEntity class test************** */
-      WorldEntity* w = NULL;
-      int i = 0;
-      unsigned long mittel = 0;
-      
-      for(i = 0; i < ITERATIONS; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  WorldEntity* w = new WorldEntity();
-	  
-	  rdtscl(end);
-	  delete w;
-	  mittel += (end - ini - dt);
-	}
-      float mi = mittel / (float)ITERATIONS;
-      printf(" Generate a WorldEntity object:\t\t%11.2f\n", mi);
-      
-      /*
-	mittel = 0;
-	for(i = 0; i < ITERATIONS; ++i)
-	{
-	rdtscl(ini);
-	
-	WorldEntity* w = new Primitive(P_SPHERE);
-	
-	rdtscl(end);
-	delete w;
-	mittel += (end - ini - dt);
-	}
-	mi = mittel / (float)ITERATIONS;
-	printf(" Generate a Primitive  object:\t\t%11.2f\n", mi);
-      */
-
-      mittel = 0;
-      for(i = 0; i < ITERATIONS; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  Vector* v = new Vector();
-	  
-	  rdtscl(end);
-	  delete v;
-	  mittel += (end - ini - dt);
-	}
-      mi = mittel / (float)ITERATIONS;
-      printf(" Generate a Vector object:\t\t%11.2f\n", mi);
-
-
-     mittel = 0;
-      for(i = 0; i < ITERATIONS; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  Quaternion* q = new Quaternion();
-	  
-	  rdtscl(end);
-	  delete q;
-	  mittel += (end - ini - dt);
-	}
-      mi = mittel / (float)ITERATIONS;
-      printf(" Generate a Quaternion object:\t\t%11.2f\n", mi);
-
-
-
-
-      printf("\nCalling function inline &| virtual, \t\t\t%i\n", ITERATIONS);
-      mittel = 0;
-      w = new WorldEntity();
-      for(i = 0; i < ITERATIONS; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  w->tick(0.0f);
-
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	  }
-      //delete w;
-      mi = mittel / (float)ITERATIONS;
-      printf(" Virt funct tick() of WE: \t\t%11.2f\n", mi);
-
-
-      mittel = 0;
-      WorldEntity wo;
-      for(i = 0; i < ITERATIONS; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  wo.tick(0.0f);
-	   
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	  }
-      //delete w;
-      mi = mittel / (float)ITERATIONS;
-      printf(" Inl virt funct tick() of WE v2: \t%11.2f\n", mi);
-
-      
-      mittel = 0;
-      BaseObject* bo = new BaseObject();
-      for(i = 0; i < ITERATIONS; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  bo->isFinalized();
-	   
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	  }
-      //delete w;
-      mi = mittel / (float)ITERATIONS;
-      printf(" Inl funct BaseObject::isFinazlized(): \t%11.2f\n", mi);
-
-      
-      tList<WorldEntity>* list = new tList<WorldEntity>();
-
-      
-      /* ************Primitvie class test************** */
-      list = new tList<WorldEntity>();
- 
-      
-      /*
-	mittel = 0;
-	w = new Primitive(P_SPHERE);
-	for(i = 0; i < ITERATIONS; ++i)
-	{
-	rdtscl(ini);
-	
-	w->tick(0.0f);
-	
-	rdtscl(end);
-	mittel += (end - ini - dt);
-	}
-	mi = mittel / (float)ITERATIONS;
-	printf(" Call function tick() of Prim:\t\t%11.2f\n", mi);
-      */
-      
-    }
-  
-  if(type == 1 || type == -1)
-    {
-      printf("\nDoing some simple vector operations: \t\t\t%i\n", VECTOR_MAX);
-      /* vector test */
-      Vector* a = new Vector(1.3, 5.3, 4.1);
-      Vector* b = new Vector(0.4, 2.5, 6.2);
-      Vector* c = new Vector();
-      
-      unsigned long mittel, ini, end;
-      float mi;
-      int i = 0;
-      // addition
-      mittel = 0;
-      for(i = 0; i < VECTOR_MAX; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  *c = *a + *b;
-	   
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	}
-      mi = mittel / (float)VECTOR_MAX;
-      printf(" Addition of two vectors:\t\t%11.2f\n", mi);
-      
-      // multiplikation
-
-      mittel = 0;
-      for(i = 0; i < VECTOR_MAX; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  *c = a->cross( *b);
-	   
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	}
-      mi = mittel / (float)VECTOR_MAX;
-      printf(" CrossMult of two vectors:\t\t%11.2f\n", mi);
-
-    }
-  if( type == 2 || type == -1)
-    {
-      /* quaternion test */
-      printf("\nDoing some simple quaternion operations: \t\t%i\n", VECTOR_MAX);
-      /* vector test */
-      Quaternion* a = new Quaternion();
-      Quaternion* b = new Quaternion();
-      Quaternion* c = new Quaternion();
-      
-      unsigned long mittel, ini, end;
-      float mi;
-      int i = 0;
-      // quaternion generieren mit spez konstruktor
-      mittel = 0;
-      Vector* qa = new Vector(4.6, 9.3, 0.4);
-      Vector* qb = new Vector(3.5, 6.1, 4.3);
-      for(i = 0; i < VECTOR_MAX; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  Quaternion* qu = new Quaternion(*qa, *qb);
-	  
-	  rdtscl(end);
-	  delete qu;
-	  mittel += (end - ini - dt);
-	}
-      delete a;
-      delete b;
-      mi = mittel / (float)VECTOR_MAX;
-      printf(" Gen. quatern. betw. two vectors:\t%11.2f\n", mi);
-      
-      
-      // multiplication
-      mittel = 0;
-      for(i = 0; i < VECTOR_MAX; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  *c = *a * *b;
-	  
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	}
-      mi = mittel / (float)VECTOR_MAX;
-      printf(" Multiplying two quat.(=rot): a * b\t%11.2f\n", mi);
-      
-      
-      
-      // rotating a vector by a quaternion
-      mittel = 0;
-      for(i = 0; i < VECTOR_MAX; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  *qa = a->apply(*qb);
-	  
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	}
-      mi = mittel / (float)VECTOR_MAX;
-      printf(" Rot a vec by a quat: q->apply(v)\t%11.2f\n", mi);
-      
-      
-      
-      // generate rotation matrix
-      mittel = 0;
-      float matrix[4][4];
-      for(i = 0; i < VECTOR_MAX; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  a->matrix(matrix);
-	  
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	}
-      mi = mittel / (float)VECTOR_MAX;
-      printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi);
-    }
-  if( type == 3 || type == -1)
-    {
-      /* list tests*/
-      printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
-      tList<char>* list = new tList<char>();
-      char* name;
-      
-      printf(" Adding[1..10] elements to list, found:\n");
-      list->add("1");
-      list->add("2");
-      list->add("3");
-      list->add("4");
-      list->add("5");
-      list->add("6");
-      list->add("7");
-      list->add("8");
-      list->add("9");
-      list->add("10");
-      
-      /*give list out */
-      tIterator<char>* iterator = list->getIterator();
-      name = iterator->nextElement();
-      printf("  List Elements: \t\t");
-      while( name != NULL)
-	{
-	  printf("%s,", name);
-	  name = iterator->nextElement();
-	}
-      delete iterator;
-      printf("\n");
-      
-      
-      /*removing some elements from the list*/
-      printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n");
-      list->remove("2");
-      list->remove("3");
-      list->remove("6");
-      list->remove("8");
-      list->remove("10");
-      list->add("11");
-      /*give list out */
-      iterator = list->getIterator();
-      name = iterator->nextElement();
-      printf("  List Elements: \t\t");
-      while( name != NULL)
-	{
-	  printf("%s,", name);
-	  name = iterator->nextElement();
-	}
-      delete iterator;
-      printf("\n");
-      
-      delete list;
-      printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX);
-      
-      tList<int>* plist = new tList<int>();
-      unsigned long mittel, ini, end;
-      float mi;
-      int i = 0;
-      mittel = 0;
-      for(i = 0; i < LIST_MAX; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  plist->add(&i);
-	  
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	}
-      mi = mittel / (float)LIST_MAX;
-      printf(" Adding reference to list:\t\t%11.2f\n", mi);
-      
-      mittel = 0;
-      for(i = 0; i < LIST_MAX; ++i)
-	{
-	  rdtscl(ini);
-	  
-	  plist->remove(&i);
-	  
-	  rdtscl(end);
-	  mittel += (end - ini - dt);
-	}
-      mi = mittel / (float)LIST_MAX;
-      printf(" Removing 1st reference from list:\t%11.2f\n", mi);
-      
-
-      printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
-      list = new tList<char>();
-      printf(" Adding[1..10] elements to list, found:\n");
-      list->add("1");
-      list->add("2");
-      list->add("3");
-      list->add("4");
-      list->add("5");
-      list->add("6");
-      list->add("7");
-      list->add("8");
-      list->add("9");
-      list->add("10");
-      
-      /*give list out */
-      iterator = list->getIterator();
-      name = iterator->nextElement();
-      printf("  List Elements: \t\t");
-      while( name != NULL)
-	{
-	  printf("%s,", name);
-	  name = iterator->nextElement();
-	}
-      delete iterator;
-      printf("\n");
-      
-      
-      int c = 0;
-      printf(" Going trough list with nextElement(el) func: ");
-      name = list->firstElement();
-      while(c < 20)
-	{
-	  printf("%s,", name);
-	  name = list->nextElement(name);
-	  c++;
-	}
-      printf("\n");
-      
-
-      
-    }
-  
-}
-
-#else
-
-int startBenchmarks()
-{
-  PRINTF(1)("Benchmark is not implemented in this system\n");
-}
-
-#endif
Index: orxonox/trunk/src/orxonox.h
===================================================================
--- orxonox/trunk/src/orxonox.h	(revision 4130)
+++ orxonox/trunk/src/orxonox.h	(revision 4131)
@@ -77,5 +77,4 @@
 int startHelp(void);
 int startOrxonox(int argc, char** argv);
-int startBenchmarks(void);
 
 #endif /* _ORXONOX_H */
Index: orxonox/trunk/src/subprojects/benchmark.cc
===================================================================
--- orxonox/trunk/src/subprojects/benchmark.cc	(revision 4131)
+++ orxonox/trunk/src/subprojects/benchmark.cc	(revision 4131)
@@ -0,0 +1,470 @@
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+
+   ### File Specific:
+   main-programmer: Patrick Boenzli
+   co-programmer: ...
+
+*/
+
+
+#if defined __linux__ 
+
+#include "list.h"
+#include "world_entity.h"
+#include "vector.h"
+#include "player.h"
+#include "base_object.h"
+
+#include <asm/msr.h>
+#include <linux/timex.h>
+
+
+#define LIST_MAX 1000
+#define VECTOR_MAX 1000000
+#define ITERATIONS 10000
+
+
+int startBenchmarks()
+{
+
+  printf("===========================================================\n");
+  printf("=                      BENCHMARKS                         =\n");
+  printf("===========================================================\n");
+  printf(" the author is not paying any attention to cacheing effects\n");
+  printf(" of the CPU.\n\n");
+  printf("[title]\t\t\t\t\t     [cycles]\t[loops]\n\n");
+  //  printf("------------------------------------------------------------\n\n");
+
+  // first measure the time overhead:
+  unsigned long ini, end, dt, tmp;
+  rdtscl(ini); rdtscl(end);
+  dt = end - ini;
+
+  int type = -1; 
+  /* type   -1 == all 
+     type    0 == framework
+     type    1 == vector
+     type    2 == quaternion
+     type    3 == lists
+  */
+  if(type == 0 || type == -1)
+    {
+      /* framework test*/
+      
+      printf("Generating Objects:\t\t\t\t\t%i\n", ITERATIONS);
+      /* ************WorldEntity class test************** */
+      WorldEntity* w = NULL;
+      int i = 0;
+      unsigned long mittel = 0;
+      
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  WorldEntity* w = new WorldEntity();
+	  
+	  rdtscl(end);
+	  delete w;
+	  mittel += (end - ini - dt);
+	}
+      float mi = mittel / (float)ITERATIONS;
+      printf(" Generate a WorldEntity object:\t\t%11.2f\n", mi);
+      
+      /*
+	mittel = 0;
+	for(i = 0; i < ITERATIONS; ++i)
+	{
+	rdtscl(ini);
+	
+	WorldEntity* w = new Primitive(P_SPHERE);
+	
+	rdtscl(end);
+	delete w;
+	mittel += (end - ini - dt);
+	}
+	mi = mittel / (float)ITERATIONS;
+	printf(" Generate a Primitive  object:\t\t%11.2f\n", mi);
+      */
+
+      mittel = 0;
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  Vector* v = new Vector();
+	  
+	  rdtscl(end);
+	  delete v;
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)ITERATIONS;
+      printf(" Generate a Vector object:\t\t%11.2f\n", mi);
+
+
+     mittel = 0;
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  Quaternion* q = new Quaternion();
+	  
+	  rdtscl(end);
+	  delete q;
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)ITERATIONS;
+      printf(" Generate a Quaternion object:\t\t%11.2f\n", mi);
+
+
+
+
+      printf("\nCalling function inline &| virtual, \t\t\t%i\n", ITERATIONS);
+      mittel = 0;
+      w = new WorldEntity();
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  w->tick(0.0f);
+
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	  }
+      //delete w;
+      mi = mittel / (float)ITERATIONS;
+      printf(" Virt funct tick() of WE: \t\t%11.2f\n", mi);
+
+
+      mittel = 0;
+      WorldEntity wo;
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  wo.tick(0.0f);
+	   
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	  }
+      //delete w;
+      mi = mittel / (float)ITERATIONS;
+      printf(" Inl virt funct tick() of WE v2: \t%11.2f\n", mi);
+
+      
+      mittel = 0;
+      BaseObject* bo = new BaseObject();
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  bo->isFinalized();
+	   
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	  }
+      //delete w;
+      mi = mittel / (float)ITERATIONS;
+      printf(" Inl funct BaseObject::isFinazlized(): \t%11.2f\n", mi);
+
+      
+      tList<WorldEntity>* list = new tList<WorldEntity>();
+
+      
+      /* ************Primitvie class test************** */
+      list = new tList<WorldEntity>();
+ 
+      
+      /*
+	mittel = 0;
+	w = new Primitive(P_SPHERE);
+	for(i = 0; i < ITERATIONS; ++i)
+	{
+	rdtscl(ini);
+	
+	w->tick(0.0f);
+	
+	rdtscl(end);
+	mittel += (end - ini - dt);
+	}
+	mi = mittel / (float)ITERATIONS;
+	printf(" Call function tick() of Prim:\t\t%11.2f\n", mi);
+      */
+      
+    }
+  
+  if(type == 1 || type == -1)
+    {
+      printf("\nDoing some simple vector operations: \t\t\t%i\n", VECTOR_MAX);
+      /* vector test */
+      Vector* a = new Vector(1.3, 5.3, 4.1);
+      Vector* b = new Vector(0.4, 2.5, 6.2);
+      Vector* c = new Vector();
+      
+      unsigned long mittel, ini, end;
+      float mi;
+      int i = 0;
+      // addition
+      mittel = 0;
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  *c = *a + *b;
+	   
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Addition of two vectors:\t\t%11.2f\n", mi);
+      
+      // multiplikation
+
+      mittel = 0;
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  *c = a->cross( *b);
+	   
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" CrossMult of two vectors:\t\t%11.2f\n", mi);
+
+    }
+  if( type == 2 || type == -1)
+    {
+      /* quaternion test */
+      printf("\nDoing some simple quaternion operations: \t\t%i\n", VECTOR_MAX);
+      /* vector test */
+      Quaternion* a = new Quaternion();
+      Quaternion* b = new Quaternion();
+      Quaternion* c = new Quaternion();
+      
+      unsigned long mittel, ini, end;
+      float mi;
+      int i = 0;
+      // quaternion generieren mit spez konstruktor
+      mittel = 0;
+      Vector* qa = new Vector(4.6, 9.3, 0.4);
+      Vector* qb = new Vector(3.5, 6.1, 4.3);
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  Quaternion* qu = new Quaternion(*qa, *qb);
+	  
+	  rdtscl(end);
+	  delete qu;
+	  mittel += (end - ini - dt);
+	}
+      delete a;
+      delete b;
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Gen. quatern. betw. two vectors:\t%11.2f\n", mi);
+      
+      
+      // multiplication
+      mittel = 0;
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  *c = *a * *b;
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Multiplying two quat.(=rot): a * b\t%11.2f\n", mi);
+      
+      
+      
+      // rotating a vector by a quaternion
+      mittel = 0;
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  *qa = a->apply(*qb);
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Rot a vec by a quat: q->apply(v)\t%11.2f\n", mi);
+      
+      
+      
+      // generate rotation matrix
+      mittel = 0;
+      float matrix[4][4];
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  a->matrix(matrix);
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi);
+    }
+  if( type == 3 || type == -1)
+    {
+      /* list tests*/
+      printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
+      tList<char>* list = new tList<char>();
+      char* name;
+      
+      printf(" Adding[1..10] elements to list, found:\n");
+      list->add("1");
+      list->add("2");
+      list->add("3");
+      list->add("4");
+      list->add("5");
+      list->add("6");
+      list->add("7");
+      list->add("8");
+      list->add("9");
+      list->add("10");
+      
+      /*give list out */
+      tIterator<char>* iterator = list->getIterator();
+      name = iterator->nextElement();
+      printf("  List Elements: \t\t");
+      while( name != NULL)
+	{
+	  printf("%s,", name);
+	  name = iterator->nextElement();
+	}
+      delete iterator;
+      printf("\n");
+      
+      
+      /*removing some elements from the list*/
+      printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n");
+      list->remove("2");
+      list->remove("3");
+      list->remove("6");
+      list->remove("8");
+      list->remove("10");
+      list->add("11");
+      /*give list out */
+      iterator = list->getIterator();
+      name = iterator->nextElement();
+      printf("  List Elements: \t\t");
+      while( name != NULL)
+	{
+	  printf("%s,", name);
+	  name = iterator->nextElement();
+	}
+      delete iterator;
+      printf("\n");
+      
+      delete list;
+      printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX);
+      
+      tList<int>* plist = new tList<int>();
+      unsigned long mittel, ini, end;
+      float mi;
+      int i = 0;
+      mittel = 0;
+      for(i = 0; i < LIST_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  plist->add(&i);
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)LIST_MAX;
+      printf(" Adding reference to list:\t\t%11.2f\n", mi);
+      
+      mittel = 0;
+      for(i = 0; i < LIST_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  plist->remove(&i);
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)LIST_MAX;
+      printf(" Removing 1st reference from list:\t%11.2f\n", mi);
+      
+
+      printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
+      list = new tList<char>();
+      printf(" Adding[1..10] elements to list, found:\n");
+      list->add("1");
+      list->add("2");
+      list->add("3");
+      list->add("4");
+      list->add("5");
+      list->add("6");
+      list->add("7");
+      list->add("8");
+      list->add("9");
+      list->add("10");
+      
+      /*give list out */
+      iterator = list->getIterator();
+      name = iterator->nextElement();
+      printf("  List Elements: \t\t");
+      while( name != NULL)
+	{
+	  printf("%s,", name);
+	  name = iterator->nextElement();
+	}
+      delete iterator;
+      printf("\n");
+      
+      
+      int c = 0;
+      printf(" Going trough list with nextElement(el) func: ");
+      name = list->firstElement();
+      while(c < 20)
+	{
+	  printf("%s,", name);
+	  name = list->nextElement(name);
+	  c++;
+	}
+      printf("\n");
+      
+
+      
+    }
+  
+}
+
+#else
+
+int startBenchmarks()
+{
+  PRINTF(1)("Benchmark is not implemented in this system\n");
+}
+
+#endif
Index: orxonox/trunk/src/subprojects/benchmark.h
===================================================================
--- orxonox/trunk/src/subprojects/benchmark.h	(revision 4131)
+++ orxonox/trunk/src/subprojects/benchmark.h	(revision 4131)
@@ -0,0 +1,13 @@
+/*! 
+    \file benchmark.h
+    \brief benchmark functions
+*/ 
+
+
+#ifndef _BENCHMARK_H
+#define _BENCHMARK_H
+
+int startBenchmarks(void);
+
+
+#endif /* _BENCHMARK_H */
