| [4554] | 1 | /* | 
|---|
| [4131] | 2 |    orxonox - the future of 3D-vertical-scrollers | 
|---|
 | 3 |  | 
|---|
 | 4 |    Copyright (C) 2004 orx | 
|---|
 | 5 |  | 
|---|
 | 6 |    This program is free software; you can redistribute it and/or modify | 
|---|
 | 7 |    it under the terms of the GNU General Public License as published by | 
|---|
 | 8 |    the Free Software Foundation; either version 2, or (at your option) | 
|---|
 | 9 |    any later version. | 
|---|
 | 10 |  | 
|---|
 | 11 |    This program is distributed in the hope that it will be useful, | 
|---|
 | 12 |    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
 | 13 |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
 | 14 |    GNU General Public License for more details. | 
|---|
 | 15 |  | 
|---|
 | 16 |    You should have received a copy of the GNU General Public License | 
|---|
 | 17 |    along with this program; if not, write to the Free Software Foundation, | 
|---|
| [4554] | 18 |    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 
|---|
| [4131] | 19 |  | 
|---|
 | 20 |  | 
|---|
 | 21 |    ### File Specific: | 
|---|
 | 22 |    main-programmer: Patrick Boenzli | 
|---|
 | 23 |    co-programmer: ... | 
|---|
 | 24 |  | 
|---|
 | 25 | */ | 
|---|
 | 26 |  | 
|---|
 | 27 |  | 
|---|
| [4554] | 28 | #if defined __linux__ | 
|---|
| [4131] | 29 |  | 
|---|
 | 30 | #include "list.h" | 
|---|
 | 31 | #include "world_entity.h" | 
|---|
 | 32 | #include "vector.h" | 
|---|
 | 33 | #include "player.h" | 
|---|
 | 34 | #include "base_object.h" | 
|---|
 | 35 |  | 
|---|
| [5427] | 36 | #include <stdlib.h> | 
|---|
| [4131] | 37 | #include <asm/msr.h> | 
|---|
| [5750] | 38 | //#include <linux/timex.h> | 
|---|
| [4131] | 39 |  | 
|---|
 | 40 |  | 
|---|
 | 41 | #define LIST_MAX 1000 | 
|---|
 | 42 | #define VECTOR_MAX 1000000 | 
|---|
 | 43 | #define ITERATIONS 10000 | 
|---|
 | 44 |  | 
|---|
 | 45 |  | 
|---|
 | 46 | int startBenchmarks() | 
|---|
 | 47 | { | 
|---|
 | 48 |  | 
|---|
 | 49 |   printf("===========================================================\n"); | 
|---|
 | 50 |   printf("=                      BENCHMARKS                         =\n"); | 
|---|
 | 51 |   printf("===========================================================\n"); | 
|---|
 | 52 |   printf(" the author is not paying any attention to cacheing effects\n"); | 
|---|
 | 53 |   printf(" of the CPU.\n\n"); | 
|---|
 | 54 |   printf("[title]\t\t\t\t\t     [cycles]\t[loops]\n\n"); | 
|---|
 | 55 |   //  printf("------------------------------------------------------------\n\n"); | 
|---|
 | 56 |  | 
|---|
 | 57 |   // first measure the time overhead: | 
|---|
 | 58 |   unsigned long ini, end, dt, tmp; | 
|---|
 | 59 |   rdtscl(ini); rdtscl(end); | 
|---|
 | 60 |   dt = end - ini; | 
|---|
 | 61 |  | 
|---|
| [4554] | 62 |   int type = -1; | 
|---|
 | 63 |   /* type   -1 == all | 
|---|
| [4131] | 64 |      type    0 == framework | 
|---|
 | 65 |      type    1 == vector | 
|---|
 | 66 |      type    2 == quaternion | 
|---|
 | 67 |      type    3 == lists | 
|---|
 | 68 |   */ | 
|---|
 | 69 |   if(type == 0 || type == -1) | 
|---|
 | 70 |     { | 
|---|
 | 71 |       /* framework test*/ | 
|---|
| [4554] | 72 |  | 
|---|
| [4131] | 73 |       printf("Generating Objects:\t\t\t\t\t%i\n", ITERATIONS); | 
|---|
 | 74 |       /* ************WorldEntity class test************** */ | 
|---|
 | 75 |       WorldEntity* w = NULL; | 
|---|
 | 76 |       int i = 0; | 
|---|
 | 77 |       unsigned long mittel = 0; | 
|---|
| [4554] | 78 |  | 
|---|
| [4131] | 79 |       for(i = 0; i < ITERATIONS; ++i) | 
|---|
| [4554] | 80 |         { | 
|---|
 | 81 |           rdtscl(ini); | 
|---|
 | 82 |  | 
|---|
 | 83 |           WorldEntity* w = new WorldEntity(); | 
|---|
 | 84 |  | 
|---|
 | 85 |           rdtscl(end); | 
|---|
 | 86 |           delete w; | 
|---|
 | 87 |           mittel += (end - ini - dt); | 
|---|
 | 88 |         } | 
|---|
| [4131] | 89 |       float mi = mittel / (float)ITERATIONS; | 
|---|
 | 90 |       printf(" Generate a WorldEntity object:\t\t%11.2f\n", mi); | 
|---|
| [4554] | 91 |  | 
|---|
| [4131] | 92 |       /* | 
|---|
| [4554] | 93 |         mittel = 0; | 
|---|
 | 94 |         for(i = 0; i < ITERATIONS; ++i) | 
|---|
 | 95 |         { | 
|---|
 | 96 |         rdtscl(ini); | 
|---|
 | 97 |  | 
|---|
 | 98 |         WorldEntity* w = new Primitive(P_SPHERE); | 
|---|
 | 99 |  | 
|---|
 | 100 |         rdtscl(end); | 
|---|
 | 101 |         delete w; | 
|---|
 | 102 |         mittel += (end - ini - dt); | 
|---|
 | 103 |         } | 
|---|
 | 104 |         mi = mittel / (float)ITERATIONS; | 
|---|
 | 105 |         printf(" Generate a Primitive  object:\t\t%11.2f\n", mi); | 
|---|
| [4131] | 106 |       */ | 
|---|
 | 107 |  | 
|---|
 | 108 |       mittel = 0; | 
|---|
 | 109 |       for(i = 0; i < ITERATIONS; ++i) | 
|---|
| [4554] | 110 |         { | 
|---|
 | 111 |           rdtscl(ini); | 
|---|
 | 112 |  | 
|---|
 | 113 |           Vector* v = new Vector(); | 
|---|
 | 114 |  | 
|---|
 | 115 |           rdtscl(end); | 
|---|
 | 116 |           delete v; | 
|---|
 | 117 |           mittel += (end - ini - dt); | 
|---|
 | 118 |         } | 
|---|
| [4131] | 119 |       mi = mittel / (float)ITERATIONS; | 
|---|
 | 120 |       printf(" Generate a Vector object:\t\t%11.2f\n", mi); | 
|---|
 | 121 |  | 
|---|
 | 122 |  | 
|---|
 | 123 |      mittel = 0; | 
|---|
 | 124 |       for(i = 0; i < ITERATIONS; ++i) | 
|---|
| [4554] | 125 |         { | 
|---|
 | 126 |           rdtscl(ini); | 
|---|
 | 127 |  | 
|---|
 | 128 |           Quaternion* q = new Quaternion(); | 
|---|
 | 129 |  | 
|---|
 | 130 |           rdtscl(end); | 
|---|
 | 131 |           delete q; | 
|---|
 | 132 |           mittel += (end - ini - dt); | 
|---|
 | 133 |         } | 
|---|
| [4131] | 134 |       mi = mittel / (float)ITERATIONS; | 
|---|
 | 135 |       printf(" Generate a Quaternion object:\t\t%11.2f\n", mi); | 
|---|
 | 136 |  | 
|---|
 | 137 |  | 
|---|
 | 138 |  | 
|---|
 | 139 |  | 
|---|
 | 140 |       printf("\nCalling function inline &| virtual, \t\t\t%i\n", ITERATIONS); | 
|---|
 | 141 |       mittel = 0; | 
|---|
 | 142 |       w = new WorldEntity(); | 
|---|
 | 143 |       for(i = 0; i < ITERATIONS; ++i) | 
|---|
| [4554] | 144 |         { | 
|---|
 | 145 |           rdtscl(ini); | 
|---|
| [4131] | 146 |  | 
|---|
| [4554] | 147 |           w->tick(0.0f); | 
|---|
 | 148 |  | 
|---|
 | 149 |           rdtscl(end); | 
|---|
 | 150 |           mittel += (end - ini - dt); | 
|---|
 | 151 |           } | 
|---|
| [4131] | 152 |       //delete w; | 
|---|
 | 153 |       mi = mittel / (float)ITERATIONS; | 
|---|
 | 154 |       printf(" Virt funct tick() of WE: \t\t%11.2f\n", mi); | 
|---|
 | 155 |  | 
|---|
 | 156 |  | 
|---|
 | 157 |       mittel = 0; | 
|---|
 | 158 |       WorldEntity wo; | 
|---|
 | 159 |       for(i = 0; i < ITERATIONS; ++i) | 
|---|
| [4554] | 160 |         { | 
|---|
 | 161 |           rdtscl(ini); | 
|---|
 | 162 |  | 
|---|
 | 163 |           wo.tick(0.0f); | 
|---|
 | 164 |  | 
|---|
 | 165 |           rdtscl(end); | 
|---|
 | 166 |           mittel += (end - ini - dt); | 
|---|
 | 167 |           } | 
|---|
| [4131] | 168 |       //delete w; | 
|---|
 | 169 |       mi = mittel / (float)ITERATIONS; | 
|---|
 | 170 |       printf(" Inl virt funct tick() of WE v2: \t%11.2f\n", mi); | 
|---|
 | 171 |  | 
|---|
| [4554] | 172 |  | 
|---|
| [4131] | 173 |       mittel = 0; | 
|---|
 | 174 |       BaseObject* bo = new BaseObject(); | 
|---|
 | 175 |       for(i = 0; i < ITERATIONS; ++i) | 
|---|
| [4554] | 176 |         { | 
|---|
 | 177 |           rdtscl(ini); | 
|---|
 | 178 |  | 
|---|
| [4942] | 179 | //          bo->isFinalized(); | 
|---|
| [4554] | 180 |  | 
|---|
 | 181 |           rdtscl(end); | 
|---|
 | 182 |           mittel += (end - ini - dt); | 
|---|
 | 183 |           } | 
|---|
| [4131] | 184 |       //delete w; | 
|---|
 | 185 |       mi = mittel / (float)ITERATIONS; | 
|---|
 | 186 |       printf(" Inl funct BaseObject::isFinazlized(): \t%11.2f\n", mi); | 
|---|
 | 187 |  | 
|---|
| [4554] | 188 |  | 
|---|
| [4131] | 189 |       tList<WorldEntity>* list = new tList<WorldEntity>(); | 
|---|
 | 190 |  | 
|---|
| [4554] | 191 |  | 
|---|
| [4131] | 192 |       /* ************Primitvie class test************** */ | 
|---|
 | 193 |       list = new tList<WorldEntity>(); | 
|---|
| [4554] | 194 |  | 
|---|
 | 195 |  | 
|---|
| [4131] | 196 |       /* | 
|---|
| [4554] | 197 |         mittel = 0; | 
|---|
 | 198 |         w = new Primitive(P_SPHERE); | 
|---|
 | 199 |         for(i = 0; i < ITERATIONS; ++i) | 
|---|
 | 200 |         { | 
|---|
 | 201 |         rdtscl(ini); | 
|---|
 | 202 |  | 
|---|
 | 203 |         w->tick(0.0f); | 
|---|
 | 204 |  | 
|---|
 | 205 |         rdtscl(end); | 
|---|
 | 206 |         mittel += (end - ini - dt); | 
|---|
 | 207 |         } | 
|---|
 | 208 |         mi = mittel / (float)ITERATIONS; | 
|---|
 | 209 |         printf(" Call function tick() of Prim:\t\t%11.2f\n", mi); | 
|---|
| [4131] | 210 |       */ | 
|---|
| [4554] | 211 |  | 
|---|
| [4131] | 212 |     } | 
|---|
| [4554] | 213 |  | 
|---|
| [4131] | 214 |   if(type == 1 || type == -1) | 
|---|
 | 215 |     { | 
|---|
 | 216 |       printf("\nDoing some simple vector operations: \t\t\t%i\n", VECTOR_MAX); | 
|---|
 | 217 |       /* vector test */ | 
|---|
 | 218 |       Vector* a = new Vector(1.3, 5.3, 4.1); | 
|---|
 | 219 |       Vector* b = new Vector(0.4, 2.5, 6.2); | 
|---|
 | 220 |       Vector* c = new Vector(); | 
|---|
| [4554] | 221 |  | 
|---|
| [4131] | 222 |       unsigned long mittel, ini, end; | 
|---|
 | 223 |       float mi; | 
|---|
 | 224 |       int i = 0; | 
|---|
 | 225 |       // addition | 
|---|
 | 226 |       mittel = 0; | 
|---|
 | 227 |       for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 228 |         { | 
|---|
 | 229 |           rdtscl(ini); | 
|---|
 | 230 |  | 
|---|
 | 231 |           *c = *a + *b; | 
|---|
 | 232 |  | 
|---|
 | 233 |           rdtscl(end); | 
|---|
 | 234 |           mittel += (end - ini - dt); | 
|---|
 | 235 |         } | 
|---|
| [4131] | 236 |       mi = mittel / (float)VECTOR_MAX; | 
|---|
 | 237 |       printf(" Addition of two vectors:\t\t%11.2f\n", mi); | 
|---|
| [4554] | 238 |  | 
|---|
| [4131] | 239 |       // multiplikation | 
|---|
 | 240 |  | 
|---|
 | 241 |       mittel = 0; | 
|---|
 | 242 |       for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 243 |         { | 
|---|
 | 244 |           rdtscl(ini); | 
|---|
 | 245 |  | 
|---|
 | 246 |           *c = a->cross( *b); | 
|---|
 | 247 |  | 
|---|
 | 248 |           rdtscl(end); | 
|---|
 | 249 |           mittel += (end - ini - dt); | 
|---|
 | 250 |         } | 
|---|
| [4131] | 251 |       mi = mittel / (float)VECTOR_MAX; | 
|---|
 | 252 |       printf(" CrossMult of two vectors:\t\t%11.2f\n", mi); | 
|---|
 | 253 |  | 
|---|
 | 254 |     } | 
|---|
 | 255 |   if( type == 2 || type == -1) | 
|---|
 | 256 |     { | 
|---|
 | 257 |       /* quaternion test */ | 
|---|
 | 258 |       printf("\nDoing some simple quaternion operations: \t\t%i\n", VECTOR_MAX); | 
|---|
 | 259 |       /* vector test */ | 
|---|
 | 260 |       Quaternion* a = new Quaternion(); | 
|---|
 | 261 |       Quaternion* b = new Quaternion(); | 
|---|
 | 262 |       Quaternion* c = new Quaternion(); | 
|---|
| [4554] | 263 |  | 
|---|
| [4131] | 264 |       unsigned long mittel, ini, end; | 
|---|
 | 265 |       float mi; | 
|---|
 | 266 |       int i = 0; | 
|---|
 | 267 |       // quaternion generieren mit spez konstruktor | 
|---|
 | 268 |       mittel = 0; | 
|---|
 | 269 |       Vector* qa = new Vector(4.6, 9.3, 0.4); | 
|---|
 | 270 |       Vector* qb = new Vector(3.5, 6.1, 4.3); | 
|---|
 | 271 |       for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 272 |         { | 
|---|
 | 273 |           rdtscl(ini); | 
|---|
 | 274 |  | 
|---|
 | 275 |           Quaternion* qu = new Quaternion(*qa, *qb); | 
|---|
 | 276 |  | 
|---|
 | 277 |           rdtscl(end); | 
|---|
 | 278 |           delete qu; | 
|---|
 | 279 |           mittel += (end - ini - dt); | 
|---|
 | 280 |         } | 
|---|
| [4131] | 281 |       delete a; | 
|---|
 | 282 |       delete b; | 
|---|
 | 283 |       mi = mittel / (float)VECTOR_MAX; | 
|---|
 | 284 |       printf(" Gen. quatern. betw. two vectors:\t%11.2f\n", mi); | 
|---|
| [4554] | 285 |  | 
|---|
 | 286 |  | 
|---|
| [4131] | 287 |       // multiplication | 
|---|
 | 288 |       mittel = 0; | 
|---|
 | 289 |       for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 290 |         { | 
|---|
 | 291 |           rdtscl(ini); | 
|---|
 | 292 |  | 
|---|
 | 293 |           *c = *a * *b; | 
|---|
 | 294 |  | 
|---|
 | 295 |           rdtscl(end); | 
|---|
 | 296 |           mittel += (end - ini - dt); | 
|---|
 | 297 |         } | 
|---|
| [4131] | 298 |       mi = mittel / (float)VECTOR_MAX; | 
|---|
 | 299 |       printf(" Multiplying two quat.(=rot): a * b\t%11.2f\n", mi); | 
|---|
| [4554] | 300 |  | 
|---|
 | 301 |  | 
|---|
 | 302 |  | 
|---|
| [4131] | 303 |       // rotating a vector by a quaternion | 
|---|
 | 304 |       mittel = 0; | 
|---|
 | 305 |       for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 306 |         { | 
|---|
 | 307 |           rdtscl(ini); | 
|---|
 | 308 |  | 
|---|
 | 309 |           *qa = a->apply(*qb); | 
|---|
 | 310 |  | 
|---|
 | 311 |           rdtscl(end); | 
|---|
 | 312 |           mittel += (end - ini - dt); | 
|---|
 | 313 |         } | 
|---|
| [4131] | 314 |       mi = mittel / (float)VECTOR_MAX; | 
|---|
 | 315 |       printf(" Rot a vec by a quat: q->apply(v)\t%11.2f\n", mi); | 
|---|
| [4554] | 316 |  | 
|---|
 | 317 |  | 
|---|
 | 318 |  | 
|---|
| [4131] | 319 |       // generate rotation matrix | 
|---|
 | 320 |       mittel = 0; | 
|---|
 | 321 |       float matrix[4][4]; | 
|---|
 | 322 |       for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 323 |         { | 
|---|
 | 324 |           rdtscl(ini); | 
|---|
 | 325 |  | 
|---|
 | 326 |           a->matrix(matrix); | 
|---|
 | 327 |  | 
|---|
 | 328 |           rdtscl(end); | 
|---|
 | 329 |           mittel += (end - ini - dt); | 
|---|
 | 330 |         } | 
|---|
| [4131] | 331 |       mi = mittel / (float)VECTOR_MAX; | 
|---|
 | 332 |       printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi); | 
|---|
 | 333 |     } | 
|---|
 | 334 |   if( type == 3 || type == -1) | 
|---|
 | 335 |     { | 
|---|
 | 336 |       /* list tests*/ | 
|---|
 | 337 |       printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX); | 
|---|
 | 338 |       tList<char>* list = new tList<char>(); | 
|---|
 | 339 |       char* name; | 
|---|
| [4554] | 340 |  | 
|---|
| [4131] | 341 |       printf(" Adding[1..10] elements to list, found:\n"); | 
|---|
 | 342 |       list->add("1"); | 
|---|
 | 343 |       list->add("2"); | 
|---|
 | 344 |       list->add("3"); | 
|---|
 | 345 |       list->add("4"); | 
|---|
 | 346 |       list->add("5"); | 
|---|
 | 347 |       list->add("6"); | 
|---|
 | 348 |       list->add("7"); | 
|---|
 | 349 |       list->add("8"); | 
|---|
 | 350 |       list->add("9"); | 
|---|
 | 351 |       list->add("10"); | 
|---|
| [4554] | 352 |  | 
|---|
| [4131] | 353 |       /*give list out */ | 
|---|
 | 354 |       tIterator<char>* iterator = list->getIterator(); | 
|---|
| [5115] | 355 |       name = iterator->firstElement(); | 
|---|
| [4131] | 356 |       printf("  List Elements: \t\t"); | 
|---|
 | 357 |       while( name != NULL) | 
|---|
| [4554] | 358 |         { | 
|---|
 | 359 |           printf("%s,", name); | 
|---|
 | 360 |           name = iterator->nextElement(); | 
|---|
 | 361 |         } | 
|---|
| [4131] | 362 |       delete iterator; | 
|---|
 | 363 |       printf("\n"); | 
|---|
| [4554] | 364 |  | 
|---|
 | 365 |  | 
|---|
| [4131] | 366 |       /*removing some elements from the list*/ | 
|---|
 | 367 |       printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n"); | 
|---|
 | 368 |       list->remove("2"); | 
|---|
 | 369 |       list->remove("3"); | 
|---|
 | 370 |       list->remove("6"); | 
|---|
 | 371 |       list->remove("8"); | 
|---|
 | 372 |       list->remove("10"); | 
|---|
 | 373 |       list->add("11"); | 
|---|
 | 374 |       /*give list out */ | 
|---|
 | 375 |       iterator = list->getIterator(); | 
|---|
| [5115] | 376 |       name = iterator->firstElement(); | 
|---|
| [4131] | 377 |       printf("  List Elements: \t\t"); | 
|---|
 | 378 |       while( name != NULL) | 
|---|
| [4554] | 379 |         { | 
|---|
 | 380 |           printf("%s,", name); | 
|---|
 | 381 |           name = iterator->nextElement(); | 
|---|
 | 382 |         } | 
|---|
| [4131] | 383 |       delete iterator; | 
|---|
 | 384 |       printf("\n"); | 
|---|
| [4554] | 385 |  | 
|---|
| [4131] | 386 |       delete list; | 
|---|
 | 387 |       printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX); | 
|---|
| [4554] | 388 |  | 
|---|
| [4131] | 389 |       tList<int>* plist = new tList<int>(); | 
|---|
 | 390 |       unsigned long mittel, ini, end; | 
|---|
 | 391 |       float mi; | 
|---|
 | 392 |       int i = 0; | 
|---|
 | 393 |       mittel = 0; | 
|---|
 | 394 |       for(i = 0; i < LIST_MAX; ++i) | 
|---|
| [4554] | 395 |         { | 
|---|
 | 396 |           rdtscl(ini); | 
|---|
 | 397 |  | 
|---|
 | 398 |           plist->add(&i); | 
|---|
 | 399 |  | 
|---|
 | 400 |           rdtscl(end); | 
|---|
 | 401 |           mittel += (end - ini - dt); | 
|---|
 | 402 |         } | 
|---|
| [4131] | 403 |       mi = mittel / (float)LIST_MAX; | 
|---|
 | 404 |       printf(" Adding reference to list:\t\t%11.2f\n", mi); | 
|---|
| [4554] | 405 |  | 
|---|
| [4131] | 406 |       mittel = 0; | 
|---|
 | 407 |       for(i = 0; i < LIST_MAX; ++i) | 
|---|
| [4554] | 408 |         { | 
|---|
 | 409 |           rdtscl(ini); | 
|---|
 | 410 |  | 
|---|
 | 411 |           plist->remove(&i); | 
|---|
 | 412 |  | 
|---|
 | 413 |           rdtscl(end); | 
|---|
 | 414 |           mittel += (end - ini - dt); | 
|---|
 | 415 |         } | 
|---|
| [4131] | 416 |       mi = mittel / (float)LIST_MAX; | 
|---|
 | 417 |       printf(" Removing 1st reference from list:\t%11.2f\n", mi); | 
|---|
 | 418 |  | 
|---|
| [4554] | 419 |  | 
|---|
| [4131] | 420 |       printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX); | 
|---|
 | 421 |       list = new tList<char>(); | 
|---|
 | 422 |       printf(" Adding[1..10] elements to list, found:\n"); | 
|---|
 | 423 |       list->add("1"); | 
|---|
 | 424 |       list->add("2"); | 
|---|
 | 425 |       list->add("3"); | 
|---|
 | 426 |       list->add("4"); | 
|---|
 | 427 |       list->add("5"); | 
|---|
 | 428 |       list->add("6"); | 
|---|
 | 429 |       list->add("7"); | 
|---|
 | 430 |       list->add("8"); | 
|---|
 | 431 |       list->add("9"); | 
|---|
 | 432 |       list->add("10"); | 
|---|
| [4554] | 433 |  | 
|---|
| [4131] | 434 |       /*give list out */ | 
|---|
 | 435 |       iterator = list->getIterator(); | 
|---|
| [5115] | 436 |       name = iterator->firstElement(); | 
|---|
| [4131] | 437 |       printf("  List Elements: \t\t"); | 
|---|
 | 438 |       while( name != NULL) | 
|---|
| [4554] | 439 |         { | 
|---|
 | 440 |           printf("%s,", name); | 
|---|
 | 441 |           name = iterator->nextElement(); | 
|---|
 | 442 |         } | 
|---|
| [4131] | 443 |       delete iterator; | 
|---|
 | 444 |       printf("\n"); | 
|---|
| [4554] | 445 |  | 
|---|
 | 446 |  | 
|---|
| [4131] | 447 |       int c = 0; | 
|---|
 | 448 |       printf(" Going trough list with nextElement(el) func: "); | 
|---|
 | 449 |       name = list->firstElement(); | 
|---|
 | 450 |       while(c < 20) | 
|---|
| [4554] | 451 |         { | 
|---|
 | 452 |           printf("%s,", name); | 
|---|
 | 453 |           name = list->nextElement(name); | 
|---|
 | 454 |           c++; | 
|---|
 | 455 |         } | 
|---|
| [4131] | 456 |       printf("\n"); | 
|---|
 | 457 |     } | 
|---|
| [4554] | 458 |  | 
|---|
| [8457] | 459 |     return 0; | 
|---|
| [4131] | 460 | } | 
|---|
 | 461 |  | 
|---|
 | 462 | #else | 
|---|
 | 463 |  | 
|---|
| [4166] | 464 | #include "debug.h" | 
|---|
 | 465 |  | 
|---|
| [4131] | 466 | int startBenchmarks() | 
|---|
 | 467 | { | 
|---|
 | 468 |   PRINTF(1)("Benchmark is not implemented in this system\n"); | 
|---|
 | 469 | } | 
|---|
 | 470 |  | 
|---|
 | 471 | #endif | 
|---|