Changeset 596
- Timestamp:
- Nov 10, 2018, 2:53:23 PM (6 years ago)
- Location:
- trunk/user
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/fft/fft.c
r588 r596 86 86 // parameters 87 87 88 #define DEFAULT_M 1 4 // 16 Kdata points88 #define DEFAULT_M 12 // 4096 data points 89 89 #define MODE COSIN 90 90 #define CHECK 0 91 #define DEBUG_MAIN 0// trace main() function (detailed if odd)92 #define DEBUG_SLAVE 0// trace slave() function (detailed if odd)93 #define DEBUG_FFT1D 0// trace FFT1D() function (detailed if odd)91 #define DEBUG_MAIN 2 // trace main() function (detailed if odd) 92 #define DEBUG_SLAVE 2 // trace slave() function (detailed if odd) 93 #define DEBUG_FFT1D 2 // trace FFT1D() function (detailed if odd) 94 94 #define DEBUG_ROW 0 // trace FFTRow() function (detailed if odd) 95 95 #define PRINT_ARRAY 0 -
trunk/user/ksh/Makefile
r588 r596 4 4 5 5 -include ../../params-soft.mk 6 7 ifeq ($(ARCH_NAME),)8 $(error Please define in ARCH_NAME parameter in params-soft.mk!)9 endif10 6 11 7 OBJS = build/ksh.o -
trunk/user/ksh/ksh.c
r588 r596 21 21 // the TXT terminal ownership. 22 22 // 23 // A semaphore is usedto synchronize the two KSH threads. At each iteration,23 // We use a semaphore to synchronize the two KSH threads. At each iteration, 24 24 // the interactive thread check the semaphore (with a sem_wait). It blocks 25 25 // and deschedules, if the KSH process loosed the TXT ownership (after a load, … … 46 46 #include <semaphore.h> 47 47 #include <hal_macros.h> 48 #include <sys/stat.h> 49 #include <sys/mman.h> 50 #include <fcntl.h> 48 51 49 52 #define CMD_MAX_SIZE (256) // max number of characters in one command … … 53 56 #define MAIN_DEBUG 0 54 57 #define CMD_LOAD_DEBUG 0 58 #define CMD_CAT_DEBUG 1 55 59 56 60 ////////////////////////////////////////////////////////////////////////////////////////// … … 99 103 { 100 104 char * path; 105 stat_t st; // stat structure 106 int fd; 107 int size; 108 char * buf; 101 109 102 110 if (argc != 2) 103 111 { 112 fd = -1; 113 buf = NULL; 114 size = 0; 104 115 printf(" usage: cat pathname\n"); 105 return; 106 } 107 108 path = argv[1]; 109 110 printf(" error: not implemented yet\n", argc, argv ); 111 112 /* 113 // open the file 114 fd = open( path , O_RDONLY , 0 ); 115 if (fd < 0) 116 { 117 printf(" error: cannot open %s\n", path); 118 goto exit; 119 } 120 121 // get file size 122 if (stat(path, &st) == -1) 123 { 124 printf(" error: cannot stat %s\n", path); 125 goto exit; 126 } 127 if (S_ISDIR(st.st_mode)) { 128 printf(" error: %s is a directory\n", path); 129 goto exit; 130 } 131 size = st.st_size; 132 133 // mmap the file 134 buf = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); 135 if (buf == NULL || buf == (char *)-1) { 136 printf(" error: cannot map %s\n", path); 137 goto exit; 138 } 139 140 // set terminating '0' 141 buf[size-1] = 0; 142 143 // display the file content 144 printf("%s", buf); 116 goto exit; 117 } 118 119 path = argv[1]; 120 121 // open the file 122 fd = open( path , O_RDONLY , 0 ); 123 if (fd < 0) 124 { 125 buf = NULL; 126 size = 0; 127 printf(" error: cannot open %s\n", path); 128 goto exit; 129 } 130 131 #if CMD_CAT_DEBUG 132 long long unsigned cycle; 133 get_cycle( &cycle ); 134 printf("\n[%s] file %s open / cycle %d\n", 135 __FUNCTION__ , path , (int)cycle ); 136 #endif 137 138 // get file stats 139 if ( stat( path , &st ) == -1) 140 { 141 buf = NULL; 142 size = 0; 143 printf(" error: cannot stat %s\n", path); 144 goto exit; 145 } 146 147 if ( S_ISDIR(st.st_mode) ) 148 { 149 buf = NULL; 150 size = 0; 151 printf(" error: %s is a directory\n", path); 152 goto exit; 153 } 154 155 // get file size 156 size = st.st_size; 157 158 #if CMD_CAT_DEBUG 159 get_cycle( &cycle ); 160 printf("\n[%s] get size %d / cycle %d\n", 161 __FUNCTION__ , size , (int)cycle ); 162 #endif 163 164 // MAP_FILE is default type when MAP_ANON and MAP_REMOTE are not specified 165 buf = mmap( NULL , size , PROT_READ|PROT_WRITE , MAP_PRIVATE , fd , 0 ); 166 167 if ( buf == NULL ) 168 { 169 printf(" error: cannot map %s\n", path ); 170 goto exit; 171 } 172 173 #if CMD_CAT_DEBUG 174 get_cycle( &cycle ); 175 printf("\n[%s] map file %d to buffer %x / cycle %d\n", 176 __FUNCTION__ , fd , buf , (int)cycle ); 177 display_vmm( 0 , getpid() ); 178 #endif 179 180 // display the file content on TXT terminal 181 write( 1 , buf , size ); 182 183 // release semaphore to get next command 184 sem_post( &semaphore ); 185 186 return; 145 187 146 188 exit: 189 147 190 if (buf != NULL) munmap(buf, size); 148 191 if (fd >= 0) close(fd); 149 */150 192 151 193 // release semaphore to get next command … … 162 204 { 163 205 printf(" usage: cd pathname\n"); 164 return; 165 } 166 167 path = argv[1]; 168 169 printf(" error: not implemented yet\n", argc, argv ); 206 } 207 else 208 { 209 path = argv[1]; 210 211 printf(" error: not implemented yet\n" ); 212 } 170 213 171 214 // release semaphore to get next command … … 177 220 static void cmd_cp(int argc, char **argv) 178 221 { 179 // int src_fd = -1, dst_fd = -1; 180 // char *srcpath, *dstpath; 181 // struct stat st; 182 // size_t size, i; 183 // char buf[1024]; 222 int src_fd; 223 int dst_fd; 224 char * srcpath; 225 char * dstpath; 226 int size; // source file size 227 int bytes; // number of transfered bytes 228 char buf[1024]; 229 stat_t st; 184 230 185 231 if (argc != 3) 186 232 { 233 src_fd = -1; 234 dst_fd = -1; 187 235 printf(" usage: cp src_pathname dst_pathname\n"); 188 return; 189 } 190 191 printf(" error: not implemented yet\n", argc, argv ); 192 193 /* 194 srcpath = argv[1]; 195 dstpath = argv[2]; 196 197 // open the src file 198 src_fd = open(srcpath, O_RDONLY, 0); 199 if (src_fd < 0) { 200 printf(" error: cannot open %s / err = %d\n", srcpath, errno); 201 goto exit; 202 } 203 204 // get file size 205 if (stat(srcpath, &st) == -1) { 206 printf(" error: cannot stat %s\n", srcpath); 207 goto exit; 208 } 209 if (S_ISDIR(st.st_mode)) { 236 goto exit; 237 } 238 239 srcpath = argv[1]; 240 dstpath = argv[2]; 241 242 // open the src file 243 src_fd = open( srcpath , O_RDONLY , 0 ); 244 245 if ( src_fd < 0 ) 246 { 247 dst_fd = -1; 248 printf(" error: cannot open %s\n", srcpath ); 249 goto exit; 250 } 251 252 // get file stats 253 if ( stat( srcpath , &st ) ) 254 { 255 dst_fd = -1; 256 printf(" error: cannot stat %s\n", srcpath); 257 goto exit; 258 } 259 260 if ( S_ISDIR(st.st_mode) ) 261 { 262 dst_fd = -1; 210 263 printf(" error: %s is a directory\n", srcpath); 211 264 goto exit; 212 265 } 266 267 // get src file size 213 268 size = st.st_size; 214 269 215 270 // open the dst file 216 dst_fd = open(dstpath, O_CREAT|O_TRUNC|O_RDWR, 0); 217 if (dst_fd < 0) { 218 printf(" error: cannot open %s / err = %d\n", dstpath, errno); 271 dst_fd = open( dstpath , O_CREAT|O_TRUNC|O_RDWR , 0 ); 272 273 if ( dst_fd < 0 ) 274 { 275 printf(" error: cannot open %s\n", dstpath ); 219 276 goto exit; 220 277 } 221 if (stat(dstpath, &st) == -1) { 222 printf(" error: cannot stat %s\n", dstpath); 278 279 if ( stat( dstpath , &st ) ) 280 { 281 printf(" error: cannot stat %s\n", dstpath ); 223 282 goto exit; 224 283 } 225 if (S_ISDIR(st.st_mode)) { 226 printf(" error: %s is a directory\n", dstpath); 284 285 if ( S_ISDIR(st.st_mode ) ) 286 { 287 printf(" error: %s is a directory\n", dstpath ); 227 288 goto exit; 228 289 } 229 290 230 i = 0; 231 while (i < size) 291 bytes = 0; 292 293 while (bytes < size) 232 294 { 233 size_t rlen = (size - i < 1024 ? size - i : 1024);234 size_t wlen;235 ssize_t ret;295 int rlen = ((size - bytes) < 1024) ? (size - bytes) : 1024; 296 int wlen; 297 int ret; 236 298 237 299 // read the source 238 ret = read(src_fd, buf, rlen); 239 if (ret == -1) { 300 ret = read( src_fd , buf , rlen ); 301 if (ret == -1) 302 { 240 303 printf(" error: cannot read from file %s\n", srcpath); 241 304 goto exit; 242 305 } 243 rlen = (size_t)ret; 306 307 rlen = (int)ret; 244 308 245 309 // write to the destination 246 ret = write(dst_fd, buf, rlen); 247 if (ret == -1) { 310 ret = write( dst_fd , buf , rlen ); 311 if (ret == -1) 312 { 248 313 printf(" error: cannot write to file %s\n", dstpath); 249 314 goto exit; 250 315 } 251 wlen = (size_t)ret; 316 317 wlen = (int)ret; 252 318 253 319 // check 254 if (wlen != rlen) { 320 if (wlen != rlen) 321 { 255 322 printf(" error: cannot write on device\n"); 256 323 goto exit; 257 324 } 258 325 259 i+= rlen;326 bytes += rlen; 260 327 } 261 328 262 329 exit: 330 263 331 if (src_fd >= 0) close(src_fd); 264 332 if (dst_fd >= 0) close(dst_fd); 265 */266 333 267 334 // release semaphore to get next command … … 273 340 static void cmd_display( int argc , char **argv ) 274 341 { 275 unsigned int cxy; 276 unsigned int lid; 277 unsigned int pid; 278 unsigned int txt_id; 279 280 if( strcmp( argv[1] , "vmm" ) == 0 ) 342 if( argc < 2 ) 343 { 344 printf(" usage: display vmm cxy pid \n" 345 " display sched cxy lid \n" 346 " display process cxy \n" 347 " display txt txtid \n" 348 " display vfs \n" 349 " display chdev \n" 350 " display dqdt \n" 351 " display locks pid trdid \n"); 352 } 353 //////////////////////////////////// 354 else if( strcmp( argv[1] , "vmm" ) == 0 ) 281 355 { 282 356 if( argc != 4 ) 283 357 { 284 358 printf(" usage: display vmm cxy pid\n"); 285 return; 286 } 287 288 cxy = atoi(argv[2]); 289 pid = atoi(argv[3]); 290 291 if( display_vmm( cxy , pid ) ) 292 { 293 printf(" error: no process %x in cluster %x\n", pid , cxy ); 294 } 295 } 359 } 360 else 361 { 362 unsigned int cxy = atoi(argv[2]); 363 unsigned int pid = atoi(argv[3]); 364 365 if( display_vmm( cxy , pid ) ) 366 { 367 printf(" error: no process %x in cluster %x\n", pid , cxy ); 368 } 369 } 370 } 371 /////////////////////////////////////////// 296 372 else if( strcmp( argv[1] , "sched" ) == 0 ) 297 373 { … … 299 375 { 300 376 printf(" usage: display sched cxy lid\n"); 301 return; 302 } 303 304 cxy = atoi(argv[2]); 305 lid = atoi(argv[3]); 306 307 if( display_sched( cxy , lid ) ) 308 { 309 printf(" error: illegal arguments cxy = %x / lid = %d\n", cxy, lid ); 310 } 311 } 377 } 378 else 379 { 380 unsigned int cxy = atoi(argv[2]); 381 unsigned int lid = atoi(argv[3]); 382 383 if( display_sched( cxy , lid ) ) 384 { 385 printf(" error: illegal arguments cxy = %x / lid = %d\n", cxy, lid ); 386 } 387 } 388 } 389 ///////////////////////////////////////////// 312 390 else if( strcmp( argv[1] , "process" ) == 0 ) 313 391 { … … 315 393 { 316 394 printf(" usage: display process cxy\n"); 317 return; 318 } 319 320 cxy = atoi(argv[2]); 321 322 if( display_cluster_processes( cxy , 0 ) ) 323 { 324 printf(" error: illegal argument cxy = %x\n", cxy ); 325 } 326 } 395 } 396 else 397 { 398 unsigned int cxy = atoi(argv[2]); 399 400 if( display_cluster_processes( cxy , 0 ) ) 401 { 402 printf(" error: illegal argument cxy = %x\n", cxy ); 403 } 404 } 405 } 406 ///////////////////////////////////////// 327 407 else if( strcmp( argv[1] , "txt" ) == 0 ) 328 408 { … … 330 410 { 331 411 printf(" usage: display txt txt_id\n"); 332 return; 333 } 334 335 txt_id = atoi(argv[2]); 336 337 if( display_txt_processes( txt_id ) ) 338 { 339 printf(" error: illegal argument txt_id = %d\n", txt_id ); 340 } 341 } 412 } 413 else 414 { 415 unsigned int txtid = atoi(argv[2]); 416 417 if( display_txt_processes( txtid ) ) 418 { 419 printf(" error: illegal argument txtid = %d\n", txtid ); 420 } 421 } 422 } 423 ///////////////////////////////////////// 342 424 else if( strcmp( argv[1] , "vfs" ) == 0 ) 343 425 { … … 345 427 { 346 428 printf(" usage: display vfs\n"); 347 return; 348 } 349 350 display_vfs(); 351 } 429 } 430 else 431 { 432 display_vfs(); 433 } 434 } 435 ////////////////////////////////////////// 352 436 else if( strcmp( argv[1] , "chdev" ) == 0 ) 353 437 { … … 355 439 { 356 440 printf(" usage: display chdev\n"); 357 return; 358 } 359 360 display_chdev(); 361 } 441 } 442 else 443 { 444 display_chdev(); 445 } 446 } 447 ////////////////////////////////////////// 362 448 else if( strcmp( argv[1] , "dqdt" ) == 0 ) 363 449 { … … 365 451 { 366 452 printf(" usage: display dqdt\n"); 367 return; 368 } 369 370 display_dqdt(); 371 } 372 else 373 { 374 printf(" usage: display (vmm/sched/process/vfs/chdev/txt) [arg2] [arg3]\n"); 375 } 453 } 454 else 455 { 456 display_dqdt(); 457 } 458 } 459 /////////////////////////////////////////// 460 else if( strcmp( argv[1] , "locks" ) == 0 ) 461 { 462 if( argc != 4 ) 463 { 464 printf(" usage: display locks pid trdid\n"); 465 } 466 else 467 { 468 unsigned int pid = atoi(argv[2]); 469 unsigned int trdid = atoi(argv[3]); 470 471 if( display_busylocks( pid , trdid ) ) 472 { 473 printf(" error: illegal arguments pid = %x / trdid = %x\n", pid, trdid ); 474 } 475 } 476 } 477 else 478 { 479 printf(" error: undefined display request : %s\n", argv[1] ); 480 } 376 481 377 482 // release semaphore to get next command … … 388 493 { 389 494 printf(" usage: %s pid\n", argv[0]); 390 return;391 } 392 393 pid = atoi( argv[1] );394 395 if( pid == 0 )396 {397 printf(" error: PID cannot be 0\n" );398 }399 400 if( fg( pid ) )401 { 402 printf(" error: cannot find process %x\n", pid );403 495 } 496 else 497 { 498 pid = atoi( argv[1] ); 499 500 if( pid == 0 ) 501 { 502 printf(" error: PID cannot be 0\n" ); 503 } 504 else if( fg( pid ) ) 505 { 506 printf(" error: cannot find process %x\n", pid ); 507 } 508 } 404 509 405 510 // release semaphore to get next command … … 416 521 { 417 522 printf(" usage: %s\n", argv[0]); 418 return; 419 } 420 421 printf("available commands:\n"); 422 for (i = 0 ; cmd[i].name ; i++) 423 { 424 printf("\t%s\t : %s\n", cmd[i].name , cmd[i].desc); 425 } 523 } 524 else 525 { 526 printf("available commands:\n"); 527 for (i = 0 ; cmd[i].name ; i++) 528 { 529 printf("\t%s\t : %s\n", cmd[i].name , cmd[i].desc); 530 } 531 } 426 532 427 533 // release semaphore to get next command … … 438 544 { 439 545 printf(" usage: %s pid\n", argv[0]); 440 return; 441 } 442 443 pid = atoi( argv[1] ); 444 445 if( pid == 0 ) 446 { 447 printf(" error: kernel process 0 cannot be killed\n" ); 448 } 449 450 if( kill( pid , SIGKILL ) ) 451 { 452 printf(" error: process %x cannot be killed\n", pid ); 453 } 546 } 547 else 548 { 549 pid = atoi( argv[1] ); 550 551 if( pid == 0 ) 552 { 553 printf(" error: kernel process 0 cannot be killed\n" ); 554 } 555 556 else if( kill( pid , SIGKILL ) ) 557 { 558 printf(" error: process %x cannot be killed\n", pid ); 559 } 560 } 454 561 455 562 // release semaphore to get next command … … 472 579 { 473 580 printf(" usage: %s pathname [cxy] [&]\n", argv[0] ); 474 return; 475 } 476 477 pathname = argv[1]; 478 479 if( argc == 2 ) 480 { 481 background = 0; 482 placement = 0; 483 cxy = 0; 484 } 485 else if( argc == 3 ) 486 { 487 if( (argv[2][0] == '&') && (argv[2][1] == 0) ) 488 { 489 background = 1; 581 } 582 else 583 { 584 pathname = argv[1]; 585 586 if( argc == 2 ) 587 { 588 background = 0; 490 589 placement = 0; 491 590 cxy = 0; 492 591 } 493 else 494 { 495 background = 0; 592 else if( argc == 3 ) 593 { 594 if( (argv[2][0] == '&') && (argv[2][1] == 0) ) 595 { 596 background = 1; 597 placement = 0; 598 cxy = 0; 599 } 600 else 601 { 602 background = 0; 603 placement = 1; 604 cxy = atoi( argv[2] ); 605 } 606 } 607 else // argc == 4 608 { 609 background = ( (argv[3][0] == '&') && (argv[3][1] == 0) ); 496 610 placement = 1; 497 611 cxy = atoi( argv[2] ); 498 612 } 499 } 500 else // argc == 4 501 { 502 background = ( (argv[3][0] == '&') && (argv[3][1] == 0) ); 503 placement = 1; 504 cxy = atoi( argv[2] ); 505 } 506 507 // get KSH process PID 508 ksh_pid = getpid(); 613 614 // get KSH process PID 615 ksh_pid = getpid(); 509 616 510 617 #if CMD_LOAD_DEBUG … … 515 622 #endif 516 623 517 // set target cluster if required 518 if( placement ) place_fork( cxy ); 519 520 // KSH process fork CHILD process 521 ret_fork = fork(); 522 523 if ( ret_fork < 0 ) // it is a failure reported to KSH 524 { 525 printf(" error: ksh process unable to fork\n"); 526 return; 527 } 528 else if (ret_fork == 0) // it is the CHILD process 529 { 624 // set target cluster if required 625 if( placement ) place_fork( cxy ); 626 627 // KSH process fork CHILD process 628 ret_fork = fork(); 629 630 if ( ret_fork < 0 ) // it is a failure reported to KSH 631 { 632 printf(" error: ksh process unable to fork\n"); 633 } 634 else if (ret_fork == 0) // it is the CHILD process 635 { 530 636 531 637 #if CMD_LOAD_DEBUG … … 535 641 #endif 536 642 537 // CHILD process exec NEW process538 ret_exec = execve( pathname , NULL , NULL );643 // CHILD process exec NEW process 644 ret_exec = execve( pathname , NULL , NULL ); 539 645 540 646 #if CMD_LOAD_DEBUG … … 544 650 #endif 545 651 546 // this is only executed in case of exec failure547 if( ret_exec )548 {549 printf(" error: child process unable to exec <%s>\n", pathname );550 exit( 0 );551 }552 }553 else // it is the KSH process : ret_fork is the new process PID554 {652 // this is only executed in case of exec failure 653 if( ret_exec ) 654 { 655 printf(" error: child process unable to exec <%s>\n", pathname ); 656 exit( 0 ); 657 } 658 } 659 else // it is the KSH process : ret_fork is the new process PID 660 { 555 661 556 662 #if CMD_LOAD_DEBUG … … 560 666 #endif 561 667 562 if( background ) // child in background => KSH must keep TXT ownership 563 { 564 // execve() tranfered TXT ownership to child => give it back to KSH 565 fg( ksh_pid ); 566 567 // release semaphore to get next command 568 sem_post( &semaphore ); 569 } 570 } 668 if( background ) // child in background => KSH must keep TXT ownership 669 { 670 fg( ksh_pid ); 671 } 672 } 673 } 674 675 // release semaphore to get next command 676 sem_post( &semaphore ); 677 571 678 } // end cmd_load 572 679 … … 579 686 { 580 687 printf(" usage: %s\n", argv[0], argc ); 581 return; 582 } 583 584 printf("--- registered commands ---\n"); 585 for (i = 0; i < LOG_DEPTH; i++) 586 { 587 printf(" - %d\t: %s\n", i, &log_entries[i].buf); 588 } 688 } 689 else 690 { 691 printf("--- registered commands ---\n"); 692 for (i = 0; i < LOG_DEPTH; i++) 693 { 694 printf(" - %d\t: %s\n", i, &log_entries[i].buf); 695 } 696 } 589 697 590 698 // release semaphore to get next command … … 602 710 // DIR *dir; 603 711 604 if (argc == 1) 605 { 606 path = "."; 607 } 608 else if (argc == 2) 609 { 610 path = argv[1]; 611 } 612 else 712 if (argc > 2 ) 613 713 { 614 714 printf(" usage: ls [path]\n"); 615 return; 616 } 617 618 printf(" error: not implemented yet\n"); 715 } 716 else 717 { 718 if ( argc == 1 ) path = "."; 719 else path = argv[1]; 720 721 printf(" error: not implemented yet\n"); 619 722 /* 620 723 dir = opendir( path ); … … 625 728 closedir(dir); 626 729 */ 730 } 627 731 628 732 // release semaphore to get next command … … 639 743 { 640 744 printf(" usage: mkdir pathname\n"); 641 return; 642 } 643 644 pathname = argv[1]; 645 646 printf(" error: not implemented yet\n"); 745 } 746 else 747 { 748 pathname = argv[1]; 749 750 printf(" error: not implemented yet\n"); 751 } 647 752 648 753 // release semaphore to get next command … … 657 762 if (argc < 3) 658 763 { 659 printf(" usage : %s src_pathname dst_pathname\n", argv[0]); 660 return; 661 } 662 663 printf(" error: not implemented yet\n"); 764 printf(" usage : mv src_pathname dst_pathname\n"); 765 } 766 else 767 { 768 printf(" error: not implemented yet\n"); 769 } 664 770 665 771 // release semaphore to get next command … … 681 787 { 682 788 printf(" usage: %s\n", argv[0]); 683 return; 684 } 685 686 // get platform config 687 get_config( &x_size , &y_size , &ncores ); 688 689 // scan all clusers 690 for( x = 0 ; x < x_size ; x++ ) 691 { 692 for( y = 0 ; y < y_size ; y++ ) 693 { 694 display_cluster_processes( HAL_CXY_FROM_XY(x,y), 1 ); // only owned processes 789 } 790 else 791 { 792 // get platform config 793 get_config( &x_size , &y_size , &ncores ); 794 795 // scan all clusters 796 for( x = 0 ; x < x_size ; x++ ) 797 { 798 for( y = 0 ; y < y_size ; y++ ) 799 { 800 // display only owned processes 801 display_cluster_processes( HAL_CXY_FROM_XY(x,y), 1 ); 802 } 695 803 } 696 804 } … … 709 817 { 710 818 printf(" usage: %s\n", argv[0]); 711 return;712 }713 714 if ( getcwd( buf , 1024 ) )715 {716 printf(" error: unable to get current directory\n");717 819 } 718 820 else 719 821 { 720 printf("%s\n", buf); 721 } 822 if ( getcwd( buf , 1024 ) ) 823 { 824 printf(" error: unable to get current directory\n"); 825 } 826 else 827 { 828 printf("%s\n", buf); 829 } 830 } 722 831 723 832 // release semaphore to get next command … … 734 843 { 735 844 printf(" usage: %s pathname\n", argv[0]); 736 return; 737 } 738 739 pathname = argv[1]; 740 741 printf(" error: not implemented yet\n"); 845 } 846 else 847 { 848 pathname = argv[1]; 849 850 printf(" error: not implemented yet\n"); 851 } 742 852 743 853 // release semaphore to get next command … … 762 872 { 763 873 printf(" usage: trace cxy lid \n"); 764 return; 765 } 766 767 cxy = atoi(argv[1]); 768 lid = atoi(argv[2]); 769 770 if( trace( 1 , cxy , lid ) ) 771 { 772 printf(" error: core[%x,%d] not found\n", cxy, lid ); 874 } 875 else 876 { 877 cxy = atoi(argv[1]); 878 lid = atoi(argv[2]); 879 880 if( trace( 1 , cxy , lid ) ) 881 { 882 printf(" error: core[%x,%d] not found\n", cxy, lid ); 883 } 773 884 } 774 885 … … 787 898 { 788 899 printf(" usage: untrace cxy lid \n"); 789 return; 790 } 791 792 cxy = atoi(argv[1]); 793 lid = atoi(argv[2]); 794 795 if( trace( 0 , cxy , lid ) ) 796 { 797 printf(" error: core[%x,%d] not found\n", cxy, lid ); 900 } 901 else 902 { 903 cxy = atoi(argv[1]); 904 lid = atoi(argv[2]); 905 906 if( trace( 0 , cxy , lid ) ) 907 { 908 printf(" error: core[%x,%d] not found\n", cxy, lid ); 909 } 798 910 } 799 911 -
trunk/user/sort/sort.c
r588 r596 24 24 #include <stdio.h> 25 25 #include <stdlib.h> 26 #include <unistd.h> 26 27 #include <pthread.h> 27 28 #include <almosmkh.h> … … 157 158 ///////////////////////////////// 158 159 pthread_barrier_wait( &barrier ); 159 printf("\n[SORT] thread[%d] exit barrier \n", thread_uid );160 printf("\n[SORT] thread[%d] exit barrier 0\n", thread_uid ); 160 161 161 162 // the number of threads contributing to sort … … 192 193 ///////////////////////////////// 193 194 pthread_barrier_wait( &barrier ); 194 printf("\n[SORT] thread[%d] exit barrier \n", thread_uid);195 printf("\n[SORT] thread[%d] exit barrier %d\n", thread_uid , i ); 195 196 196 197 } … … 223 224 pthread_barrierattr_t barrier_attr; // barrier attributes 224 225 225 // compute number of threads (one thread per proc)226 // compute number of threads (one thread per core) 226 227 get_config( &x_size , &y_size , &ncores ); 227 228 threads = x_size * y_size * ncores; … … 268 269 for ( n = 0 ; n < ARRAY_LENGTH ; n++ ) 269 270 { 270 array0[n] = rand();271 array0[n] = ARRAY_LENGTH - n - 1; 271 272 } 272 273 … … 315 316 } 316 317 } 317 318 #if INTERACTIVE_MODE319 idbg();320 #endif321 318 } 322 319 }
Note: See TracChangeset
for help on using the changeset viewer.