Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3661 in orxonox.OLD for orxonox/trunk/src/orxonox.cc


Ignore:
Timestamp:
Mar 29, 2005, 10:34:25 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: some changes in the benchmark routines and in the list. list is now more efficent than ever and is integrated in the benchmark system.

File:
1 edited

Legend:

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

    r3660 r3661  
    346346
    347347
    348 #define LIST_MAX 10000
     348#define LIST_MAX 1000
    349349#define VECTOR_MAX 1000000
    350350#define ITERATIONS 10000
     
    635635          printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi);
    636636        }
     637      if( type == 3 || type == -1)
     638        {
     639          /* list tests*/
     640          printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
     641          tList<char>* list = new tList<char>();
     642          char* name;
     643
     644          printf(" Adding[1..10] elements to list, found:\n");
     645          list->add("1");
     646          list->add("2");
     647          list->add("3");
     648          list->add("4");
     649          list->add("5");
     650          list->add("6");
     651          list->add("7");
     652          list->add("8");
     653          list->add("9");
     654          list->add("10");
     655
     656          /*give list out */
     657          tIterator<char>* iterator = list->getIterator();
     658          name = iterator->nextElement();
     659          printf("  List Elements: \t\t");
     660          while( name != NULL)
     661            {
     662              printf("%s,", name);
     663              name = iterator->nextElement();
     664            }
     665          delete iterator;
     666          printf("\n");
     667
     668
     669          /*removing some elements from the list*/
     670          printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n");
     671          list->remove("2");
     672          list->remove("3");
     673          list->remove("6");
     674          list->remove("8");
     675          list->remove("10");
     676          list->add("11");
     677          /*give list out */
     678          iterator = list->getIterator();
     679          name = iterator->nextElement();
     680          printf("  List Elements: \t\t");
     681          while( name != NULL)
     682            {
     683              printf("%s,", name);
     684              name = iterator->nextElement();
     685            }
     686          delete iterator;
     687          printf("\n");
     688         
     689          delete list;
     690          printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX);
     691
     692          tList<int>* plist = new tList<int>();
     693          unsigned long mittel, ini, end;
     694          float mi;
     695          int i = 0;
     696          mittel = 0;
     697          for(i = 0; i < LIST_MAX; ++i)
     698            {
     699              rdtscl(ini);
     700             
     701              plist->add(&i);
     702             
     703              rdtscl(end);
     704              mittel += (end - ini - dt);
     705            }
     706          mi = mittel / (float)LIST_MAX;
     707          printf(" Adding reference to list:\t\t%11.2f\n", mi);
     708
     709          mittel = 0;
     710          for(i = 0; i < LIST_MAX; ++i)
     711            {
     712              rdtscl(ini);
     713             
     714              plist->remove(&i);
     715             
     716              rdtscl(end);
     717              mittel += (end - ini - dt);
     718            }
     719          mi = mittel / (float)LIST_MAX;
     720          printf(" Removing 1st reference from list:\t%11.2f\n", mi);
     721         
     722         
     723
     724        }
    637725    }
    638726}
Note: See TracChangeset for help on using the changeset viewer.