Changeset 626 for trunk/user/sort/sort.c
- Timestamp:
- Apr 29, 2019, 7:25:09 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/sort/sort.c
r625 r626 29 29 #include <hal_macros.h> 30 30 31 #define ARRAY_LENGTH 256// number of items31 #define ARRAY_LENGTH 1024 // number of items 32 32 #define MAX_THREADS 1024 // 16 * 16 * 4 33 33 … … 38 38 #define CHECK_RESULT 0 // for debug 39 39 #define INSTRUMENTATION 1 // register computation times on file 40 #define IDBG 0 // activate interactive debug in main 40 41 41 42 ///////////////////////////////////////////////////////////// … … 439 440 #if INSTRUMENTATION 440 441 441 char name[64]; 442 char path[128]; 442 char name[64]; 443 char path[128]; 444 unsigned long long instru_cycle; 443 445 444 446 // build a file name from n_items / n_clusters / n_cores … … 461 463 name, sequencial, parallel ); 462 464 465 #if IDBG 466 idbg(); 467 #endif 468 463 469 // open file 470 get_cycle( &instru_cycle ); 464 471 FILE * stream = fopen( path , NULL ); 472 465 473 if( stream == NULL ) 466 474 { 467 printf("\n[sort error] cannot open instrumentation file <%s>\n", name);475 printf("\n[sort error] cannot open instrumentation file <%s>\n", path ); 468 476 exit(0); 469 477 } 470 478 471 printf("\n[sort] file %s successfully open\n", path); 479 printf("\n[sort] file <%s> open at cycle %d\n", path, (unsigned int)instru_cycle ); 480 481 #if IDBG 482 idbg(); 483 #endif 472 484 473 485 // register results to file 486 get_cycle( &instru_cycle ); 474 487 int ret = fprintf( stream , "\n----- %s -----\n" 475 488 " - sequencial : %d cycles\n" … … 477 490 if( ret < 0 ) 478 491 { 479 printf("\n[sort error] cannot write to instrumentation file <%s>\n", name);492 printf("\n[sort error] cannot write to instrumentation file <%s>\n", path ); 480 493 exit(0); 481 494 } 482 495 483 printf("\n[sort] file %s successfully written\n", path); 496 printf("\n[sort] file <%s> written at cycle %d\n", path, (unsigned int)instru_cycle ); 497 498 #if IDBG 499 idbg(); 500 #endif 484 501 485 502 // close instrumentation file 486 487 if( fclose( stream ) ) 488 { 489 printf("\n[sort error] cannot close the file <%s>\n", name ); 503 get_cycle( &instru_cycle ); 504 ret = fclose( stream ); 505 506 if( ret ) 507 { 508 printf("\n[sort error] cannot close instrumentation file <%s>\n", path ); 490 509 exit(0); 491 510 } 492 511 493 printf("\n[sort] file %s successfully closed\n", path);512 printf("\n[sort] file <%s> closed at cycle %d\n", path, (unsigned int)instru_cycle ); 494 513 495 514 #endif
Note: See TracChangeset
for help on using the changeset viewer.