Changeset 3648 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Mar 24, 2005, 12:53:54 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/orxonox.cc
r3619 r3648 268 268 } 269 269 270 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 281 270 282 /** 271 283 \brief main function … … 275 287 int main(int argc, char** argv) 276 288 { 289 290 /* reading arguments 291 292 currently supported arguments are: 293 <no args> :: just starts orxonox 294 --benchmark :: start the benchmark without starting orxonox 295 296 this is a preselection: it matches to one of the start* functions, the 297 finetuning is made in those functions. 298 */ 299 300 301 int i; 302 for(i = 0; i < argc; ++i) 303 { 304 if(! strcmp( "--help", argv[i])) return startHelp(); 305 else if(! strcmp( "--benchmark", argv[i])) return startBenchmarks(); 306 } 307 308 PRINTF(2)("Orxonox does not understand the arguments"); 309 return startOrxonox(argc, argv); 310 } 311 312 313 314 int startHelp() 315 { 316 printf("orxonox: starts the orxonox game - rules\n"); 317 printf("usage: orxonox [arg]\n\n"); 318 printf("valid options:\n"); 319 printf(" --benchmark\tstarts the orxonox benchmark\n"); 320 printf(" --help \tshows this menu\n"); 321 } 322 323 int startOrxonox(int argc, char** argv) 324 { 277 325 printf(">>> Starting Orxonox <<<\n"); 278 326 Orxonox *orx = Orxonox::getInstance(); … … 288 336 //delete orx; 289 337 290 return 0; 291 } 338 } 339 340 341 int startBenchmarks() 342 { 343 344 printf("===========================================================\n"); 345 printf("= BENCHMARKS =\n"); 346 printf("===========================================================\n"); 347 348 // first measure the time overhead: 349 unsigned long ini, end, dt, tmp; 350 rdtscl(ini); rdtscl(end); 351 dt = end - ini; 352 353 int type = 0; 354 /* type -1 == all 355 type 0 == framework 356 type 1 == vector 357 type 2 == quaternion 358 */ 359 if(type == 0 || type == -1) 360 { 361 /* framework test*/ 362 WorldEntity* w = NULL; 363 int i = 0; 364 unsigned long mittel = 0; 365 366 for(i = 0; i < ITERATIONS; ++i) 367 { 368 rdtscl(ini); 369 370 WorldEntity* w = new WorldEntity(); 371 372 rdtscl(end); 373 mittel += (end - ini - dt); 374 } 375 float mi = mittel / (float)ITERATIONS; 376 printf("Generate a WorldEntity objec [cycles]t: \t%f\n", mi); 377 378 379 mittel = 0; 380 w = new WorldEntity(); 381 for(i = 0; i < ITERATIONS; ++i) 382 { 383 rdtscl(ini); 384 385 w->tick(0.0f); 386 387 rdtscl(end); 388 mittel += (end - ini - dt); 389 } 390 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 } 411 412 } 413 if(type == 1 || type == -1) 414 { 415 /* vector test */ 416 Vector* a = new Vector(1.3, 5.3, 4.1); 417 Vector* b = new Vector(0.4, 2.5, 6.2); 418 Vector* c = new Vector(); 419 420 int i = 0; 421 // addition 422 for(i = 0; i < VECTOR_MAX; ++i) 423 { 424 *c = *a + *b; 425 } 426 427 // multiplikation 428 for(i = 0; i < VECTOR_MAX; ++i) 429 { 430 *c = a->cross( *b); 431 } 432 if(type == 1 || type == -1) 433 { 434 /* quaternion test */ 435 436 } 437 438 439 } 440 } -
orxonox/trunk/src/orxonox.h
r3613 r3648 72 72 }; 73 73 74 int startHelp(void); 75 int startOrxonox(int argc, char** argv); 76 int startBenchmarks(void); 77 74 78 #endif /* _ORXONOX_H */ 75 79
Note: See TracChangeset
for help on using the changeset viewer.