| [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: | 
|---|
| [9406] | 58 | unsigned long ini, end, dt; | 
|---|
| [4131] | 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 | for(i = 0; i < ITERATIONS; ++i) | 
|---|
| [4554] | 175 | { | 
|---|
|  | 176 | rdtscl(ini); | 
|---|
|  | 177 |  | 
|---|
| [4942] | 178 | //          bo->isFinalized(); | 
|---|
| [4554] | 179 |  | 
|---|
|  | 180 | rdtscl(end); | 
|---|
|  | 181 | mittel += (end - ini - dt); | 
|---|
|  | 182 | } | 
|---|
| [4131] | 183 | //delete w; | 
|---|
|  | 184 | mi = mittel / (float)ITERATIONS; | 
|---|
|  | 185 | printf(" Inl funct BaseObject::isFinazlized(): \t%11.2f\n", mi); | 
|---|
|  | 186 |  | 
|---|
| [4554] | 187 |  | 
|---|
| [4131] | 188 | tList<WorldEntity>* list = new tList<WorldEntity>(); | 
|---|
|  | 189 |  | 
|---|
| [4554] | 190 |  | 
|---|
| [4131] | 191 | /* ************Primitvie class test************** */ | 
|---|
|  | 192 | list = new tList<WorldEntity>(); | 
|---|
| [4554] | 193 |  | 
|---|
|  | 194 |  | 
|---|
| [4131] | 195 | /* | 
|---|
| [4554] | 196 | mittel = 0; | 
|---|
|  | 197 | w = new Primitive(P_SPHERE); | 
|---|
|  | 198 | for(i = 0; i < ITERATIONS; ++i) | 
|---|
|  | 199 | { | 
|---|
|  | 200 | rdtscl(ini); | 
|---|
|  | 201 |  | 
|---|
|  | 202 | w->tick(0.0f); | 
|---|
|  | 203 |  | 
|---|
|  | 204 | rdtscl(end); | 
|---|
|  | 205 | mittel += (end - ini - dt); | 
|---|
|  | 206 | } | 
|---|
|  | 207 | mi = mittel / (float)ITERATIONS; | 
|---|
|  | 208 | printf(" Call function tick() of Prim:\t\t%11.2f\n", mi); | 
|---|
| [4131] | 209 | */ | 
|---|
| [4554] | 210 |  | 
|---|
| [4131] | 211 | } | 
|---|
| [4554] | 212 |  | 
|---|
| [4131] | 213 | if(type == 1 || type == -1) | 
|---|
|  | 214 | { | 
|---|
|  | 215 | printf("\nDoing some simple vector operations: \t\t\t%i\n", VECTOR_MAX); | 
|---|
|  | 216 | /* vector test */ | 
|---|
|  | 217 | Vector* a = new Vector(1.3, 5.3, 4.1); | 
|---|
|  | 218 | Vector* b = new Vector(0.4, 2.5, 6.2); | 
|---|
|  | 219 | Vector* c = new Vector(); | 
|---|
| [4554] | 220 |  | 
|---|
| [4131] | 221 | unsigned long mittel, ini, end; | 
|---|
|  | 222 | float mi; | 
|---|
|  | 223 | int i = 0; | 
|---|
|  | 224 | // addition | 
|---|
|  | 225 | mittel = 0; | 
|---|
|  | 226 | for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 227 | { | 
|---|
|  | 228 | rdtscl(ini); | 
|---|
|  | 229 |  | 
|---|
|  | 230 | *c = *a + *b; | 
|---|
|  | 231 |  | 
|---|
|  | 232 | rdtscl(end); | 
|---|
|  | 233 | mittel += (end - ini - dt); | 
|---|
|  | 234 | } | 
|---|
| [4131] | 235 | mi = mittel / (float)VECTOR_MAX; | 
|---|
|  | 236 | printf(" Addition of two vectors:\t\t%11.2f\n", mi); | 
|---|
| [4554] | 237 |  | 
|---|
| [4131] | 238 | // multiplikation | 
|---|
|  | 239 |  | 
|---|
|  | 240 | mittel = 0; | 
|---|
|  | 241 | for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 242 | { | 
|---|
|  | 243 | rdtscl(ini); | 
|---|
|  | 244 |  | 
|---|
|  | 245 | *c = a->cross( *b); | 
|---|
|  | 246 |  | 
|---|
|  | 247 | rdtscl(end); | 
|---|
|  | 248 | mittel += (end - ini - dt); | 
|---|
|  | 249 | } | 
|---|
| [4131] | 250 | mi = mittel / (float)VECTOR_MAX; | 
|---|
|  | 251 | printf(" CrossMult of two vectors:\t\t%11.2f\n", mi); | 
|---|
|  | 252 |  | 
|---|
|  | 253 | } | 
|---|
|  | 254 | if( type == 2 || type == -1) | 
|---|
|  | 255 | { | 
|---|
|  | 256 | /* quaternion test */ | 
|---|
|  | 257 | printf("\nDoing some simple quaternion operations: \t\t%i\n", VECTOR_MAX); | 
|---|
|  | 258 | /* vector test */ | 
|---|
|  | 259 | Quaternion* a = new Quaternion(); | 
|---|
|  | 260 | Quaternion* b = new Quaternion(); | 
|---|
|  | 261 | Quaternion* c = new Quaternion(); | 
|---|
| [4554] | 262 |  | 
|---|
| [4131] | 263 | unsigned long mittel, ini, end; | 
|---|
|  | 264 | float mi; | 
|---|
|  | 265 | int i = 0; | 
|---|
|  | 266 | // quaternion generieren mit spez konstruktor | 
|---|
|  | 267 | mittel = 0; | 
|---|
|  | 268 | Vector* qa = new Vector(4.6, 9.3, 0.4); | 
|---|
|  | 269 | Vector* qb = new Vector(3.5, 6.1, 4.3); | 
|---|
|  | 270 | for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 271 | { | 
|---|
|  | 272 | rdtscl(ini); | 
|---|
|  | 273 |  | 
|---|
|  | 274 | Quaternion* qu = new Quaternion(*qa, *qb); | 
|---|
|  | 275 |  | 
|---|
|  | 276 | rdtscl(end); | 
|---|
|  | 277 | delete qu; | 
|---|
|  | 278 | mittel += (end - ini - dt); | 
|---|
|  | 279 | } | 
|---|
| [4131] | 280 | delete a; | 
|---|
|  | 281 | delete b; | 
|---|
|  | 282 | mi = mittel / (float)VECTOR_MAX; | 
|---|
|  | 283 | printf(" Gen. quatern. betw. two vectors:\t%11.2f\n", mi); | 
|---|
| [4554] | 284 |  | 
|---|
|  | 285 |  | 
|---|
| [4131] | 286 | // multiplication | 
|---|
|  | 287 | mittel = 0; | 
|---|
|  | 288 | for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 289 | { | 
|---|
|  | 290 | rdtscl(ini); | 
|---|
|  | 291 |  | 
|---|
|  | 292 | *c = *a * *b; | 
|---|
|  | 293 |  | 
|---|
|  | 294 | rdtscl(end); | 
|---|
|  | 295 | mittel += (end - ini - dt); | 
|---|
|  | 296 | } | 
|---|
| [4131] | 297 | mi = mittel / (float)VECTOR_MAX; | 
|---|
|  | 298 | printf(" Multiplying two quat.(=rot): a * b\t%11.2f\n", mi); | 
|---|
| [4554] | 299 |  | 
|---|
|  | 300 |  | 
|---|
|  | 301 |  | 
|---|
| [4131] | 302 | // rotating a vector by a quaternion | 
|---|
|  | 303 | mittel = 0; | 
|---|
|  | 304 | for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 305 | { | 
|---|
|  | 306 | rdtscl(ini); | 
|---|
|  | 307 |  | 
|---|
|  | 308 | *qa = a->apply(*qb); | 
|---|
|  | 309 |  | 
|---|
|  | 310 | rdtscl(end); | 
|---|
|  | 311 | mittel += (end - ini - dt); | 
|---|
|  | 312 | } | 
|---|
| [4131] | 313 | mi = mittel / (float)VECTOR_MAX; | 
|---|
|  | 314 | printf(" Rot a vec by a quat: q->apply(v)\t%11.2f\n", mi); | 
|---|
| [4554] | 315 |  | 
|---|
|  | 316 |  | 
|---|
|  | 317 |  | 
|---|
| [4131] | 318 | // generate rotation matrix | 
|---|
|  | 319 | mittel = 0; | 
|---|
|  | 320 | float matrix[4][4]; | 
|---|
|  | 321 | for(i = 0; i < VECTOR_MAX; ++i) | 
|---|
| [4554] | 322 | { | 
|---|
|  | 323 | rdtscl(ini); | 
|---|
|  | 324 |  | 
|---|
|  | 325 | a->matrix(matrix); | 
|---|
|  | 326 |  | 
|---|
|  | 327 | rdtscl(end); | 
|---|
|  | 328 | mittel += (end - ini - dt); | 
|---|
|  | 329 | } | 
|---|
| [4131] | 330 | mi = mittel / (float)VECTOR_MAX; | 
|---|
|  | 331 | printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi); | 
|---|
|  | 332 | } | 
|---|
|  | 333 | if( type == 3 || type == -1) | 
|---|
|  | 334 | { | 
|---|
|  | 335 | /* list tests*/ | 
|---|
|  | 336 | printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX); | 
|---|
|  | 337 | tList<char>* list = new tList<char>(); | 
|---|
|  | 338 | char* name; | 
|---|
| [4554] | 339 |  | 
|---|
| [4131] | 340 | printf(" Adding[1..10] elements to list, found:\n"); | 
|---|
|  | 341 | list->add("1"); | 
|---|
|  | 342 | list->add("2"); | 
|---|
|  | 343 | list->add("3"); | 
|---|
|  | 344 | list->add("4"); | 
|---|
|  | 345 | list->add("5"); | 
|---|
|  | 346 | list->add("6"); | 
|---|
|  | 347 | list->add("7"); | 
|---|
|  | 348 | list->add("8"); | 
|---|
|  | 349 | list->add("9"); | 
|---|
|  | 350 | list->add("10"); | 
|---|
| [4554] | 351 |  | 
|---|
| [4131] | 352 | /*give list out */ | 
|---|
|  | 353 | tIterator<char>* iterator = list->getIterator(); | 
|---|
| [5115] | 354 | name = iterator->firstElement(); | 
|---|
| [4131] | 355 | printf("  List Elements: \t\t"); | 
|---|
|  | 356 | while( name != NULL) | 
|---|
| [4554] | 357 | { | 
|---|
|  | 358 | printf("%s,", name); | 
|---|
|  | 359 | name = iterator->nextElement(); | 
|---|
|  | 360 | } | 
|---|
| [4131] | 361 | delete iterator; | 
|---|
|  | 362 | printf("\n"); | 
|---|
| [4554] | 363 |  | 
|---|
|  | 364 |  | 
|---|
| [4131] | 365 | /*removing some elements from the list*/ | 
|---|
|  | 366 | printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n"); | 
|---|
|  | 367 | list->remove("2"); | 
|---|
|  | 368 | list->remove("3"); | 
|---|
|  | 369 | list->remove("6"); | 
|---|
|  | 370 | list->remove("8"); | 
|---|
|  | 371 | list->remove("10"); | 
|---|
|  | 372 | list->add("11"); | 
|---|
|  | 373 | /*give list out */ | 
|---|
|  | 374 | iterator = list->getIterator(); | 
|---|
| [5115] | 375 | name = iterator->firstElement(); | 
|---|
| [4131] | 376 | printf("  List Elements: \t\t"); | 
|---|
|  | 377 | while( name != NULL) | 
|---|
| [4554] | 378 | { | 
|---|
|  | 379 | printf("%s,", name); | 
|---|
|  | 380 | name = iterator->nextElement(); | 
|---|
|  | 381 | } | 
|---|
| [4131] | 382 | delete iterator; | 
|---|
|  | 383 | printf("\n"); | 
|---|
| [4554] | 384 |  | 
|---|
| [4131] | 385 | delete list; | 
|---|
|  | 386 | printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX); | 
|---|
| [4554] | 387 |  | 
|---|
| [4131] | 388 | tList<int>* plist = new tList<int>(); | 
|---|
|  | 389 | unsigned long mittel, ini, end; | 
|---|
|  | 390 | float mi; | 
|---|
|  | 391 | int i = 0; | 
|---|
|  | 392 | mittel = 0; | 
|---|
|  | 393 | for(i = 0; i < LIST_MAX; ++i) | 
|---|
| [4554] | 394 | { | 
|---|
|  | 395 | rdtscl(ini); | 
|---|
|  | 396 |  | 
|---|
|  | 397 | plist->add(&i); | 
|---|
|  | 398 |  | 
|---|
|  | 399 | rdtscl(end); | 
|---|
|  | 400 | mittel += (end - ini - dt); | 
|---|
|  | 401 | } | 
|---|
| [4131] | 402 | mi = mittel / (float)LIST_MAX; | 
|---|
|  | 403 | printf(" Adding reference to list:\t\t%11.2f\n", mi); | 
|---|
| [4554] | 404 |  | 
|---|
| [4131] | 405 | mittel = 0; | 
|---|
|  | 406 | for(i = 0; i < LIST_MAX; ++i) | 
|---|
| [4554] | 407 | { | 
|---|
|  | 408 | rdtscl(ini); | 
|---|
|  | 409 |  | 
|---|
|  | 410 | plist->remove(&i); | 
|---|
|  | 411 |  | 
|---|
|  | 412 | rdtscl(end); | 
|---|
|  | 413 | mittel += (end - ini - dt); | 
|---|
|  | 414 | } | 
|---|
| [4131] | 415 | mi = mittel / (float)LIST_MAX; | 
|---|
|  | 416 | printf(" Removing 1st reference from list:\t%11.2f\n", mi); | 
|---|
|  | 417 |  | 
|---|
| [4554] | 418 |  | 
|---|
| [4131] | 419 | printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX); | 
|---|
|  | 420 | list = new tList<char>(); | 
|---|
|  | 421 | printf(" Adding[1..10] elements to list, found:\n"); | 
|---|
|  | 422 | list->add("1"); | 
|---|
|  | 423 | list->add("2"); | 
|---|
|  | 424 | list->add("3"); | 
|---|
|  | 425 | list->add("4"); | 
|---|
|  | 426 | list->add("5"); | 
|---|
|  | 427 | list->add("6"); | 
|---|
|  | 428 | list->add("7"); | 
|---|
|  | 429 | list->add("8"); | 
|---|
|  | 430 | list->add("9"); | 
|---|
|  | 431 | list->add("10"); | 
|---|
| [4554] | 432 |  | 
|---|
| [4131] | 433 | /*give list out */ | 
|---|
|  | 434 | iterator = list->getIterator(); | 
|---|
| [5115] | 435 | name = iterator->firstElement(); | 
|---|
| [4131] | 436 | printf("  List Elements: \t\t"); | 
|---|
|  | 437 | while( name != NULL) | 
|---|
| [4554] | 438 | { | 
|---|
|  | 439 | printf("%s,", name); | 
|---|
|  | 440 | name = iterator->nextElement(); | 
|---|
|  | 441 | } | 
|---|
| [4131] | 442 | delete iterator; | 
|---|
|  | 443 | printf("\n"); | 
|---|
| [4554] | 444 |  | 
|---|
|  | 445 |  | 
|---|
| [4131] | 446 | int c = 0; | 
|---|
|  | 447 | printf(" Going trough list with nextElement(el) func: "); | 
|---|
|  | 448 | name = list->firstElement(); | 
|---|
|  | 449 | while(c < 20) | 
|---|
| [4554] | 450 | { | 
|---|
|  | 451 | printf("%s,", name); | 
|---|
|  | 452 | name = list->nextElement(name); | 
|---|
|  | 453 | c++; | 
|---|
|  | 454 | } | 
|---|
| [4131] | 455 | printf("\n"); | 
|---|
|  | 456 | } | 
|---|
| [4554] | 457 |  | 
|---|
| [8495] | 458 | return 0; | 
|---|
| [4131] | 459 | } | 
|---|
|  | 460 |  | 
|---|
|  | 461 | #else | 
|---|
|  | 462 |  | 
|---|
| [4166] | 463 | #include "debug.h" | 
|---|
|  | 464 |  | 
|---|
| [4131] | 465 | int startBenchmarks() | 
|---|
|  | 466 | { | 
|---|
|  | 467 | PRINTF(1)("Benchmark is not implemented in this system\n"); | 
|---|
|  | 468 | } | 
|---|
|  | 469 |  | 
|---|
|  | 470 | #endif | 
|---|