Changeset 34d1d98 for tools/tracesplit/tracesplit.c
- Timestamp:
- 05/05/08 10:13:17 (14 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 89404f5
- Parents:
- 0bfd4a0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracesplit/tracesplit.c
r4423dc7 r34d1d98 40 40 "-S --snaplen Snap packets at the specified length\n" 41 41 "-v --verbose Output statistics\n" 42 "-z --compress Set compression level\n" 42 43 ,argv0); 43 44 exit(1); … … 72 73 uint16_t snaplen = 0; 73 74 int verbose=0; 75 int compress_level=-1; 74 76 75 77 if (argc<2) { … … 92 94 { "snaplen", 1, 0, 'S' }, 93 95 { "verbose", 0, 0, 'v' }, 96 { "compress", 1, 0, 'z' }, 94 97 { NULL, 0, 0, 0 }, 95 98 }; 96 99 97 int c=getopt_long(argc, argv, "f:c:b:s:e:i:m:S:Hv ",100 int c=getopt_long(argc, argv, "f:c:b:s:e:i:m:S:Hvz:", 98 101 long_options, &option_index); 99 102 … … 124 127 case 'v': 125 128 verbose++; 129 break; 130 case 'z': 131 compress_level=atoi(optarg); 132 if (compress_level<0 || compress_level>9) { 133 usage(argv[0]); 134 exit(1); 135 } 126 136 break; 127 137 default: … … 204 214 if (!output) { 205 215 char *buffer; 216 bool need_ext=false; 206 217 if (maxfiles <= filescreated) { 207 218 break; … … 211 222 buffer=strdupcat(buffer,"-"); 212 223 buffer=strdupcati(buffer,(uint64_t)firsttime); 224 need_ext=true; 213 225 } 214 226 if (count!=UINT64_MAX && maxfiles>1) { 215 227 buffer=strdupcat(buffer,"-"); 216 228 buffer=strdupcati(buffer,(uint64_t)pktcount); 229 need_ext=true; 217 230 } 218 231 if (bytes!=UINT64_MAX && maxfiles>1) { … … 220 233 buffer=strdupcat(buffer,"-"); 221 234 buffer=strdupcati(buffer,(uint64_t)++filenum); 235 need_ext=true; 236 } 237 if (need_ext) { 238 if (compress_level!=0) 239 buffer=strdupcat(buffer,".gz"); 222 240 } 223 241 output=trace_create_output(buffer); … … 227 245 break; 228 246 } 247 if (compress_level!=-1) { 248 if (trace_config_output(output, 249 TRACE_OPTION_OUTPUT_COMPRESS, 250 &compress_level)==-1) { 251 trace_perror_output(output,"Unable to set compression"); 252 } 253 } 229 254 trace_start_output(output); 230 255 if (trace_is_err_output(output)) { … … 232 257 free(buffer); 233 258 break; 259 } 260 if (verbose) { 261 fprintf(stderr,"%s\n",buffer); 234 262 } 235 263 free(buffer);
Note: See TracChangeset
for help on using the changeset viewer.