Changeset 442 for trunk/user/sort


Ignore:
Timestamp:
May 16, 2018, 4:13:12 PM (7 years ago)
Author:
alain
Message:

Introduce idbg application.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user/sort/sort.c

    r441 r442  
    2727#include <pthread.h>
    2828
    29 #define ARRAY_LENGTH        0x100    // 256 values
     29#define ARRAY_LENGTH        0x400    // 1024 values
    3030
    3131#define MAX_THREADS         1024     // 16 * 16 * 4
    3232
    3333#define DISPLAY_ARRAY       0
    34 #define DISPLAY_THREADS     1
     34#define INTERACTIVE_MODE    1
    3535
    3636///////////////////////////////////////////////////////
     
    159159    unsigned int  stages     = __builtin_ctz( threads ) + 1;
    160160
     161    printf("\n[SORT] thread[%d] : start\n", thread_uid );
     162
    161163    bubbleSort( array0, items, items * thread_uid );
    162164
     
    165167    /////////////////////////////////
    166168    pthread_barrier_wait( &barrier );
    167 
    168169    printf("\n[SORT] thread[%d] exit barrier\n", thread_uid );
    169170
     
    201202        /////////////////////////////////
    202203        pthread_barrier_wait( &barrier );
     204        printf("\n[SORT] thread[%d] exit barrier\n", thread_uid );
    203205
    204206    }
     
    316318                                         &arg[thread_uid] ) ) // sort arguments
    317319                    {
    318                         printf("\n[SORT ERROR] main created thread %x \n", thread_uid );
     320                        printf("\n[SORT ERROR] main cannot create thread %x \n", thread_uid );
    319321                        exit( 0 );
    320322                    }
     323                    else
     324                    {
     325                        printf("\n[SORT] main created thread %x \n", thread_uid );
     326                    }
    321327                }
    322          
    323 #if DISPLAY_THREADS
    324 display_sched( CXY_FROM_XY(x,y) , lid );
     328
     329#if INTERACTIVE_MODE
     330idbg();
    325331#endif
    326332            }
    327333        }
    328334    }
    329 
     335   
    330336    get_cycle( &cycle );
    331337    printf("\n[SORT] main completes threads create at cycle %d\n", (unsigned int)cycle );
     
    334340    sort( &arg[main_uid] );
    335341
    336 while( 1 ) asm volatile( "nop" );
     342#if INTERACTIVE_MODE
     343idbg();
     344#endif
    337345   
    338346    // Check result
Note: See TracChangeset for help on using the changeset viewer.