Changeset 4889


Ignore:
Timestamp:
07/10/12 14:00:35 (6 years ago)
Author:
paulf
Message:

added in new feature to putpick to allow delay between pick releases to be provided on command line

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/diagnostic_tools/putpick/putpick.c

    r1591 r4889  
    6262   double     tlast, dt; 
    6363   int        firstpick = 1; 
     64   int        pauseMsecs = 0; 
    6465 
    6566/* Check command line arguments 
     
    6768   if ( argc < 4 ) 
    6869   { 
    69       printf( "Usage: putpick <pickfile> <RING_NAME> <pause: y/n>\n" ); 
     70      printf( "Usage: putpick <pickfile> <RING_NAME> <pause: y/n or microsecs delay>\n" ); 
    7071      exit( -1 ); 
    7172   } 
     
    8687/* Set the pause flag 
    8788   ******************/ 
     89   pauseMsecs = atoi(argv[3]); 
    8890   if      ( strcmp(argv[3],"y") == 0 ) pause = 1; 
    8991   else if ( strcmp(argv[3],"Y") == 0 ) pause = 1; 
    9092   else if ( strcmp(argv[3],"n") == 0 ) pause = 0; 
    9193   else if ( strcmp(argv[3],"N") == 0 ) pause = 0; 
     94   else if ( pauseMsecs > 0) pause = 2; 
    9295   else 
    9396   { 
    94       logit("e", "putpick: Must specify pause: y or n\n"); 
     97      logit("e", "putpick: Must specify pause: y or n or value of milliseconds to pause\n"); 
    9598      exit( -3 ); 
    9699   } 
     
    107110   tport_attach( &region, RingKey ); 
    108111   logit("o", "putpick: Writing to <%s> ", ringname ); 
    109    if( pause ) logit( "o", "with relative timing based on pick times.\n" ); 
     112   if( pause == 1) logit( "o", "with relative timing based on pick times.\n" ); 
     113   else if( pause == 2) logit( "o", "with relative timing of %d milliseconds between pick releases.\n", pauseMsecs ); 
    110114   else        logit( "o", "as fast as I can read the file!\n" ); 
    111115 
     
    133137            dt = pick.tpick - tlast; 
    134138         /* Pause only if this pick is "younger" than newest pick sent */ 
    135             if( dt > 0.0 ) { 
     139            if (pause == 2) { 
     140               sleep_ew( (int)(pauseMsecs) ); 
     141            } else if( dt > 0.0 ) { 
    136142               logit("o","putpick: going to sleep for %.2lf seconds\n", dt ); 
    137143               sleep_ew( (int)(dt*1000) ); 
Note: See TracChangeset for help on using the changeset viewer.