Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3650 in orxonox.OLD


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

orxonox/trunk: benchmarking: modified formatting added some more measurement

File:
1 edited

Legend:

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

    r3649 r3650  
    350350  printf("=                      BENCHMARKS                         =\n");
    351351  printf("===========================================================\n");
     352  printf(" the author is not paying any attention to cacheing effects\n");
     353  printf(" of the CPU.\n\n");
     354  printf("[title]\t\t\t\t\t     [cycles]\t[loops]\n\n");
     355  //  printf("------------------------------------------------------------\n\n");
    352356
    353357  // first measure the time overhead:
     
    366370      /* framework test*/
    367371
    368       printf("Generating Objects:\n");
     372      printf("Generating Objects:\t\t\t\t\t%i\n", ITERATIONS);
    369373      /* ************WorldEntity class test************** */
    370374      WorldEntity* w = NULL;
     
    383387        }
    384388      float mi = mittel / (float)ITERATIONS;
    385       printf(" Generate a WorldEntity objec [cycles]: \t%f\n", mi);
     389      printf(" Generate a WorldEntity object:\t\t%11.2f\n", mi);
    386390     
    387391      mittel = 0;
     
    397401        }
    398402      mi = mittel / (float)ITERATIONS;
    399       printf(" Generate a Primitive  objec [cycles]:\t\t%f\n", mi);
    400 
    401       printf("\nCalling function inline &| virtual\n");
     403      printf(" Generate a Primitive  object:\t\t%11.2f\n", mi);
     404
     405
     406      mittel = 0;
     407      for(i = 0; i < ITERATIONS; ++i)
     408        {
     409          rdtscl(ini);
     410         
     411          Vector* v = new Vector();
     412         
     413          rdtscl(end);
     414          delete v;
     415          mittel += (end - ini - dt);
     416        }
     417      mi = mittel / (float)ITERATIONS;
     418      printf(" Generate a Vector object:\t\t%11.2f\n", mi);
     419
     420
     421     mittel = 0;
     422      for(i = 0; i < ITERATIONS; ++i)
     423        {
     424          rdtscl(ini);
     425         
     426          Quaternion* q = new Quaternion();
     427         
     428          rdtscl(end);
     429          delete q;
     430          mittel += (end - ini - dt);
     431        }
     432      mi = mittel / (float)ITERATIONS;
     433      printf(" Generate a Quaternion object:\t\t%11.2f\n", mi);
     434
     435
     436
     437
     438      printf("\nCalling function inline &| virtual, \t\t\t%i\n", ITERATIONS);
    402439      mittel = 0;
    403440      w = new WorldEntity();
     
    413450      //delete w;
    414451      mi = mittel / (float)ITERATIONS;
    415       printf(" virt funct tick() of WE [cycles]: \t\t%f\n", mi);
     452      printf(" Virt funct tick() of WE: \t\t%11.2f\n", mi);
    416453
    417454
     
    429466      //delete w;
    430467      mi = mittel / (float)ITERATIONS;
    431       printf(" inl virt funct tick() of WE v2 [cycles]: \t%f\n", mi);
     468      printf(" Inl virt funct tick() of WE v2: \t%11.2f\n", mi);
    432469
    433470     
     
    452489          }
    453490      mi = mittel / (float)ITERATIONS;
    454       printf("Call function tick() of Prim [cycles]:\t\t%f\n", mi);
     491      printf(" Call function tick() of Prim:\t\t%11.2f\n", mi);
    455492
    456493
     
    458495  if(type == 1 || type == -1)
    459496    {
     497      printf("\nDoing some simple vector operations: \t\t\t%i\n", VECTOR_MAX);
    460498      /* vector test */
    461499      Vector* a = new Vector(1.3, 5.3, 4.1);
     
    463501      Vector* c = new Vector();
    464502     
     503      unsigned long mittel, ini, end;
     504      float mi;
    465505      int i = 0;
    466506      // addition
     507      mittel = 0;
    467508      for(i = 0; i < VECTOR_MAX; ++i)
    468509        {
     510          rdtscl(ini);
     511         
    469512          *c = *a + *b;
    470         }
     513           
     514          rdtscl(end);
     515          mittel += (end - ini - dt);
     516        }
     517      mi = mittel / (float)VECTOR_MAX;
     518      printf(" Addition of two vectors:\t\t%11.2f\n", mi);
    471519     
    472520      // multiplikation
     521
     522      mittel = 0;
    473523      for(i = 0; i < VECTOR_MAX; ++i)
    474524        {
     525          rdtscl(ini);
     526         
    475527          *c = a->cross( *b);
    476         }
     528           
     529          rdtscl(end);
     530          mittel += (end - ini - dt);
     531        }
     532      mi = mittel / (float)VECTOR_MAX;
     533      printf(" CrossMult of two vectors:\t\t%11.2f\n", mi);
     534
    477535      if(type == 1 || type == -1)
    478536        {
    479537          /* quaternion test */
    480 
     538          printf("\nDoing some simple quaternion operations: \t\t%i\n", VECTOR_MAX);
     539          /* vector test */
     540          Quaternion* a = new Quaternion();
     541          Quaternion* b = new Quaternion();
     542          Quaternion* c = new Quaternion();
     543         
     544          unsigned long mittel, ini, end;
     545          float mi;
     546          int i = 0;
     547          // multiplication
     548          mittel = 0;
     549          for(i = 0; i < VECTOR_MAX; ++i)
     550            {
     551              rdtscl(ini);
     552             
     553              *c = *a * *b;
     554             
     555              rdtscl(end);
     556              mittel += (end - ini - dt);
     557            }
     558          mi = mittel / (float)VECTOR_MAX;
     559          printf(" Multiplying two quat. (=rot):\t\t%11.2f\n", mi);
     560
     561
     562          // multiplication
     563          mittel = 0;
     564          for(i = 0; i < VECTOR_MAX; ++i)
     565            {
     566              rdtscl(ini);
     567             
     568              *c = *a * *b;
     569             
     570              rdtscl(end);
     571              mittel += (end - ini - dt);
     572            }
     573          mi = mittel / (float)VECTOR_MAX;
     574          printf(" Multiplying two quat.(=rot):\t\t%11.2f\n", mi);
     575         
     576         
    481577        }
    482578     
Note: See TracChangeset for help on using the changeset viewer.