Changeset 442 for trunk


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

Introduce idbg application.

Location:
trunk/user
Files:
4 added
4 edited

Legend:

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

    r441 r442  
    1818#include <pthread.h>
    1919
    20 #define DEBUG_INIT_PROCESS 1
     20#define DEBUG_PROCESS_INIT    0
    2121
    2222// TODO make the cxy computation portable [AG]
     
    2727{
    2828    int           i;
    29     int           delay;
    3029    int           ret_fork;      // fork return value 
    3130    int           ret_exec;      // exec return value 
     
    7069             snprintf( string , 64 , "[INIT] created KSH[%d] / pid = %x", i , ret_fork );
    7170             display_string( string );
    72 
    73              // INIT wait a fixed delay between two forks
    74              for( delay = 0 ; delay < 50000 ; delay++ ) asm volatile( "nop" );
    7571        }
    7672    }
    7773 
    78 #if DEBUG_INIT_PROCESS
     74#if DEBUG_PROCESS_INIT
    7975
    8076    unsigned int  x_size;        // number of clusters in a row
     
    154150            else                                       // we are in INIT process
    155151            {
    156                 // INIT display new CHILD process PID
    157                 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 );
    158154                display_string( string );
    159155            }
    160156        } // end KSH kill handling
    161157
    162 #if DEBUG_INIT_PROCESS
     158#if DEBUG_PROCESS_INIT
    163159
    164160        // INIT displays processes and threads in all clusters
  • trunk/user/ksh/ksh.c

    r441 r442  
    238238    if( strcmp( argv[1] , "vmm" ) == 0 )
    239239    {
    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");
    243243                    return;
    244244            }
    245245
    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 );
    251252        }
    252253    }
     
    338339    if( pid == 0 )
    339340    {
    340                 printf("  error: ilegal pid format\n" );
     341                printf("  error: PID cannot be 0\n" );
    341342        }
    342343
     
    582583{
    583584        cmd_rm(argc, argv);
     585}
     586
     587///////////////////////////////////////////////
     588static 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///////////////////////////////////////////////
     609static 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    }
    584627}
    585628
     
    605648        { "rm",      "remove a file from file system",                  cmd_rm      },
    606649        { "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 },
    607652        { NULL,      NULL,                                                                              NULL        }
    608653};
     
    702747
    703748// @@@
    704 // parse("load /bin/user/sort.elf");
     749// parse("load /bin/user/hello.elf");
    705750// @@@
    706751
  • trunk/user/pgcd/pgcd.c

    r436 r442  
    4343                else            opy = opy - opx;
    4444            }
    45             printf("pgcd      = %d\n", opx);
     45            printf("pgcd      = %d", opx);
    4646        }
    4747    }
  • 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.