Changeset 442 for trunk/user
- Timestamp:
- May 16, 2018, 4:13:12 PM (7 years ago)
- Location:
- trunk/user
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/init/init.c
r441 r442 18 18 #include <pthread.h> 19 19 20 #define DEBUG_ INIT_PROCESS 120 #define DEBUG_PROCESS_INIT 0 21 21 22 22 // TODO make the cxy computation portable [AG] … … 27 27 { 28 28 int i; 29 int delay;30 29 int ret_fork; // fork return value 31 30 int ret_exec; // exec return value … … 70 69 snprintf( string , 64 , "[INIT] created KSH[%d] / pid = %x", i , ret_fork ); 71 70 display_string( string ); 72 73 // INIT wait a fixed delay between two forks74 for( delay = 0 ; delay < 50000 ; delay++ ) asm volatile( "nop" );75 71 } 76 72 } 77 73 78 #if DEBUG_ INIT_PROCESS74 #if DEBUG_PROCESS_INIT 79 75 80 76 unsigned int x_size; // number of clusters in a row … … 154 150 else // we are in INIT process 155 151 { 156 // INIT display new CHILDprocess PID157 snprintf( string , 64 , "[INIT] forked CHILD/ pid = %x", ret_fork );152 // INIT display new KSH process PID 153 snprintf( string , 64 , "[INIT] re-created KSH / pid = %x", ret_fork ); 158 154 display_string( string ); 159 155 } 160 156 } // end KSH kill handling 161 157 162 #if DEBUG_ INIT_PROCESS158 #if DEBUG_PROCESS_INIT 163 159 164 160 // INIT displays processes and threads in all clusters -
trunk/user/ksh/ksh.c
r441 r442 238 238 if( strcmp( argv[1] , "vmm" ) == 0 ) 239 239 { 240 if( argc != 3)241 { 242 printf(" usage: display vmm pid\n");240 if( argc != 4 ) 241 { 242 printf(" usage: display vmm cxy pid\n"); 243 243 return; 244 244 } 245 245 246 pid = atoi(argv[2]); 247 248 if( display_vmm( pid ) ) 249 { 250 printf(" error: illegal arguments pid = %x\n", pid ); 246 cxy = atoi(argv[2]); 247 pid = atoi(argv[3]); 248 249 if( display_vmm( cxy , pid ) ) 250 { 251 printf(" error: no process %x in cluster %x\n", pid , cxy ); 251 252 } 252 253 } … … 338 339 if( pid == 0 ) 339 340 { 340 printf(" error: ilegal pid format\n" );341 printf(" error: PID cannot be 0\n" ); 341 342 } 342 343 … … 582 583 { 583 584 cmd_rm(argc, argv); 585 } 586 587 /////////////////////////////////////////////// 588 static void cmd_trace( int argc , char **argv ) 589 { 590 unsigned int cxy; 591 unsigned int lid; 592 593 if (argc != 3) 594 { 595 printf(" usage: trace cxy lid \n"); 596 return; 597 } 598 599 cxy = atoi(argv[1]); 600 lid = atoi(argv[2]); 601 602 if( trace( 1 , cxy , lid ) ) 603 { 604 printf(" error: core[%x,%d] not found\n", cxy, lid ); 605 } 606 } 607 608 /////////////////////////////////////////////// 609 static void cmd_untrace( int argc , char **argv ) 610 { 611 unsigned int cxy; 612 unsigned int lid; 613 614 if (argc != 3) 615 { 616 printf(" usage: untrace cxy lid \n"); 617 return; 618 } 619 620 cxy = atoi(argv[1]); 621 lid = atoi(argv[2]); 622 623 if( trace( 0 , cxy , lid ) ) 624 { 625 printf(" error: core[%x,%d] not found\n", cxy, lid ); 626 } 584 627 } 585 628 … … 605 648 { "rm", "remove a file from file system", cmd_rm }, 606 649 { "rmdir", "remove a directory from file system", cmd_rmdir }, 650 { "trace", "activate trace for a given core", cmd_trace }, 651 { "untrace", "desactivate trace for a given core", cmd_untrace }, 607 652 { NULL, NULL, NULL } 608 653 }; … … 702 747 703 748 // @@@ 704 // parse("load /bin/user/ sort.elf");749 // parse("load /bin/user/hello.elf"); 705 750 // @@@ 706 751 -
trunk/user/pgcd/pgcd.c
r436 r442 43 43 else opy = opy - opx; 44 44 } 45 printf("pgcd = %d \n", opx);45 printf("pgcd = %d", opx); 46 46 } 47 47 } -
trunk/user/sort/sort.c
r441 r442 27 27 #include <pthread.h> 28 28 29 #define ARRAY_LENGTH 0x 100 // 256values29 #define ARRAY_LENGTH 0x400 // 1024 values 30 30 31 31 #define MAX_THREADS 1024 // 16 * 16 * 4 32 32 33 33 #define DISPLAY_ARRAY 0 34 #define DISPLAY_THREADS134 #define INTERACTIVE_MODE 1 35 35 36 36 /////////////////////////////////////////////////////// … … 159 159 unsigned int stages = __builtin_ctz( threads ) + 1; 160 160 161 printf("\n[SORT] thread[%d] : start\n", thread_uid ); 162 161 163 bubbleSort( array0, items, items * thread_uid ); 162 164 … … 165 167 ///////////////////////////////// 166 168 pthread_barrier_wait( &barrier ); 167 168 169 printf("\n[SORT] thread[%d] exit barrier\n", thread_uid ); 169 170 … … 201 202 ///////////////////////////////// 202 203 pthread_barrier_wait( &barrier ); 204 printf("\n[SORT] thread[%d] exit barrier\n", thread_uid ); 203 205 204 206 } … … 316 318 &arg[thread_uid] ) ) // sort arguments 317 319 { 318 printf("\n[SORT ERROR] main c reatedthread %x \n", thread_uid );320 printf("\n[SORT ERROR] main cannot create thread %x \n", thread_uid ); 319 321 exit( 0 ); 320 322 } 323 else 324 { 325 printf("\n[SORT] main created thread %x \n", thread_uid ); 326 } 321 327 } 322 323 #if DISPLAY_THREADS324 display_sched( CXY_FROM_XY(x,y) , lid);328 329 #if INTERACTIVE_MODE 330 idbg(); 325 331 #endif 326 332 } 327 333 } 328 334 } 329 335 330 336 get_cycle( &cycle ); 331 337 printf("\n[SORT] main completes threads create at cycle %d\n", (unsigned int)cycle ); … … 334 340 sort( &arg[main_uid] ); 335 341 336 while( 1 ) asm volatile( "nop" ); 342 #if INTERACTIVE_MODE 343 idbg(); 344 #endif 337 345 338 346 // Check result
Note: See TracChangeset
for help on using the changeset viewer.