Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3649 in orxonox.OLD


Ignore:
Timestamp:
Mar 24, 2005, 5:13:20 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: tuning orxonox via benchmarking, virt. inline functions can't be inline unless used in a very spec way

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/orxonox.cc

    r3648 r3649  
    269269
    270270
    271 #include "list.h"
    272 #include "world_entity.h"
    273 #include "vector.h"
    274 #include <asm/msr.h>
    275 #include <linux/timex.h>
    276 
    277 
    278 #define LIST_MAX 10000
    279 #define VECTOR_MAX 1000000
    280 #define ITERATIONS 10000
    281271
    282272/**
     
    321311}
    322312
     313
    323314int startOrxonox(int argc, char** argv)
    324315{
     
    337328 
    338329}
     330
     331
     332#include "list.h"
     333#include "world_entity.h"
     334#include "vector.h"
     335#include "player.h"
     336#include "primitive.h"
     337#include <asm/msr.h>
     338#include <linux/timex.h>
     339
     340
     341#define LIST_MAX 10000
     342#define VECTOR_MAX 1000000
     343#define ITERATIONS 10000
    339344
    340345
     
    351356  dt = end - ini;
    352357
    353   int type = 0;
     358  int type = -1;
    354359  /* type   -1 == all
    355360     type    0 == framework
     
    360365    {
    361366      /* framework test*/
     367
     368      printf("Generating Objects:\n");
     369      /* ************WorldEntity class test************** */
    362370      WorldEntity* w = NULL;
    363371      int i = 0;
     
    371379         
    372380          rdtscl(end);
     381          delete w;
    373382          mittel += (end - ini - dt);
    374383        }
    375384      float mi = mittel / (float)ITERATIONS;
    376       printf("Generate a WorldEntity objec [cycles]t: \t%f\n", mi);
    377      
    378      
     385      printf(" Generate a WorldEntity objec [cycles]: \t%f\n", mi);
     386     
     387      mittel = 0;
     388      for(i = 0; i < ITERATIONS; ++i)
     389        {
     390          rdtscl(ini);
     391         
     392          WorldEntity* w = new Primitive(P_SPHERE);
     393         
     394          rdtscl(end);
     395          delete w;
     396          mittel += (end - ini - dt);
     397        }
     398      mi = mittel / (float)ITERATIONS;
     399      printf(" Generate a Primitive  objec [cycles]:\t\t%f\n", mi);
     400
     401      printf("\nCalling function inline &| virtual\n");
    379402      mittel = 0;
    380403      w = new WorldEntity();
     404      for(i = 0; i < ITERATIONS; ++i)
     405        {
     406          rdtscl(ini);
     407         
     408          w->tick(0.0f);
     409
     410          rdtscl(end);
     411          mittel += (end - ini - dt);
     412          }
     413      //delete w;
     414      mi = mittel / (float)ITERATIONS;
     415      printf(" virt funct tick() of WE [cycles]: \t\t%f\n", mi);
     416
     417
     418      mittel = 0;
     419      WorldEntity wo;
     420      for(i = 0; i < ITERATIONS; ++i)
     421        {
     422          rdtscl(ini);
     423         
     424          wo.tick(0.0f);
     425           
     426          rdtscl(end);
     427          mittel += (end - ini - dt);
     428          }
     429      //delete w;
     430      mi = mittel / (float)ITERATIONS;
     431      printf(" inl virt funct tick() of WE v2 [cycles]: \t%f\n", mi);
     432
     433     
     434      tList<WorldEntity>* list = new tList<WorldEntity>();
     435
     436     
     437      /* ************Primitvie class test************** */
     438      list = new tList<WorldEntity>();
     439 
     440     
     441     
     442      mittel = 0;
     443      w = new Primitive(P_SPHERE);
    381444      for(i = 0; i < ITERATIONS; ++i)
    382445        {
     
    389452          }
    390453      mi = mittel / (float)ITERATIONS;
    391       printf("Call an empty function of WE [cycles]t: \t%f\n", mi);
    392      
    393       tList<WorldEntity>* list = new tList<WorldEntity>();
    394      
    395      
    396       // generating list
    397       for(i = 0; i < LIST_MAX; ++i)
    398         {
    399           w = new WorldEntity();
    400           list->add(w);
    401         }
    402        
    403      
    404         // reuse list
    405       w = list->enumerate();
    406       while( w != NULL)
    407         {
    408           w->tick(0.0f);
    409           w = list->nextElement();
    410         }
     454      printf("Call function tick() of Prim [cycles]:\t\t%f\n", mi);
     455
    411456
    412457      }
  • orxonox/trunk/src/world_entities/primitive.cc

    r3616 r3649  
    149149   \param time in sec
    150150*/
    151 void Primitive::tick (float time)
     151inline void Primitive::tick (float time)
    152152{
    153153  // Vector v(0.0, 0.0, 1.0);
     
    159159   \brief drawing function of the object
    160160*/
    161 void Primitive::draw ()
     161inline void Primitive::draw ()
    162162{
    163163  glMatrixMode(GL_MODELVIEW);
  • orxonox/trunk/src/world_entities/world_entity.cc

    r3608 r3649  
    170170   Handle all stuff that should update with time inside this method (movement, animation, etc.)
    171171*/
    172 void WorldEntity::tick(float time)
     172inline void WorldEntity::tick(float time)
    173173{
    174174}
     
    180180   This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn.
    181181*/
    182 void WorldEntity::draw()
     182inline void WorldEntity::draw()
    183183{}
    184184
Note: See TracChangeset for help on using the changeset viewer.