Changeset 8138


Ignore:
Timestamp:
04/10/20 08:50:12 (3 months ago)
Author:
paulf
Message:

added noflush command to sniffwave

File:
1 edited

Legend:

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

    r7996 r8138  
    155155 
    156156#define NLOGO 5 
    157 #define VERSION "2018-03-15 2.5.7" 
     157#define VERSION "2020-04-10 2.6.0" 
    158158 
    159159#define TYPE_NOTUSED 254 
     
    237237   int n_scnl_time = 0;                                  /* current number of scnl_time items */ 
    238238   MSRecord *msr = NULL;        /* mseed record */ 
     239   int no_flush = 0; /* option to not flush at startup */ 
    239240    
    240241   seconds_to_live = 0; 
     242 
    241243   dataflag = 0; 
    242244   statistics_flag = 0; 
     
    253255    argc--; 
    254256    verbose = 1; 
     257  } 
     258  if (argc > 2 && strcmp(argv[argc-1], "noflush") == 0) { 
     259    argc--; 
     260    no_flush = 1; 
    255261  } 
    256262 
     
    301307  /* Check command line argument 
    302308  *****************************/ 
    303   if ( argc < 2 || argc > 6 ) 
     309  if ( argc < 2 || argc > 7 ) 
    304310  { 
    305      if(argc > 6) 
     311     if(argc > 7) 
    306312       fprintf(stderr, "sniffwave: Too many parameters\n"); 
    307313     fprintf(stderr, "%s version %s\n", argv[0], VERSION); 
    308      fprintf(stderr,"\nUsage: %s <ring name> [sta] [comp] [net] [loc] [y/n/s/time] [v]\n", argv[0]); 
    309      fprintf(stderr, "\n Note: All parameters are positional, and all but first are optional.\n"); 
     314     fprintf(stderr,"\nUsage: %s <ring name> [sta] [comp] [net] [loc] [y/n/s/time] [noflush] [v]\n", argv[0]); 
     315     fprintf(stderr, "\n Note: ALL PARAMETERS ARE POSITIONAL, and all but first are optional.\n"); 
    310316     fprintf(stderr, "\n Appending the optional 'v' or 'verbose' argument causes module,\n"); 
    311317     fprintf(stderr, " installation and type names to be printed in addition to usual ID numbers.\n"); 
     318     fprintf(stderr, " Specifying noflush as the last or 2nd to last argument causes current ring contents to be dumped.\n"); 
     319     fprintf(stderr, " Otherwise, the default mode of sniffwave is to flush the ring to the start time.\n"); 
    312320     fprintf(stderr, "\n The <y/n/s> flag is a data flag or 'time in seconds'. If 'y' is specified\n"); 
    313321     fprintf(stderr, " the full data contained in the packet is printed out.\n"); 
     
    433441  } 
    434442 
    435   /* Flush the ring 
     443  /* To Flush the ring or not..... new in 2020 
    436444  *****************/ 
    437   while ( tport_copyfrom( &region, getlogo, nLogo, &logo, &gotsize, 
    438             (char *)&msg, MAX_TRACEBUF_SIZ, &sequence_number ) != GET_NONE ) 
    439   { 
    440          packet_total++; 
    441          packet_total_size+=gotsize; 
    442   } 
    443   fprintf( stderr, "sniffwave: inRing flushed %ld packets of %ld bytes total.\n", 
    444                 packet_total, packet_total_size); 
     445  if (!no_flush) { 
     446      while ( tport_copyfrom( &region, getlogo, nLogo, &logo, &gotsize, 
     447                (char *)&msg, MAX_TRACEBUF_SIZ, &sequence_number ) != GET_NONE ) 
     448      { 
     449             packet_total++; 
     450             packet_total_size+=gotsize; 
     451      } 
     452      fprintf( stderr, "sniffwave: inRing flushed %ld packets of %ld bytes total.\n", 
     453                    packet_total, packet_total_size); 
     454  } else { 
     455      fprintf( stderr, "sniffwave: NOT FLUSHING RING AT STARTUP\n"); 
     456  } 
    445457 
    446458  if (seconds_to_live > 0) { 
Note: See TracChangeset for help on using the changeset viewer.