Changeset aa27e1e for examples/capture/capture.c
- Timestamp:
- 10/26/04 16:16:27 (18 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:
- a6d38b6
- Parents:
- 678048a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/capture/capture.c
r678048a raa27e1e 52 52 typedef enum counter_type { 53 53 BYTES = 0, 54 PACKETS = 1 54 PACKETS = 1, 55 LOSS = 2, 55 56 } counter_type_t; 56 57 57 #define MAXCOUNTERTYPE ( PACKETS + 1)58 #define MAXCOUNTERTYPE (LOSS + 1) 58 59 59 60 uint32_t counter[MAXCOUNTERTYPE]; … … 70 71 71 72 if (hdrcount >= 10) { 72 printf("Byte count: Packet count:\n");73 printf("Byte count: Packet count: Loss count\n"); 73 74 hdrcount = 0; 74 75 } 75 76 hdrcount++; 76 printf("\t\t%d\t\t \t%d \n",77 printf("\t\t%d\t\t%d\t\t%d \n", 77 78 counter[BYTES], 78 counter[PACKETS]); 79 counter[PACKETS], 80 counter[LOSS]); 79 81 counter[BYTES] = 0; 80 82 counter[PACKETS] = 0; 83 counter[LOSS] = 0; 81 84 docalc=0; 82 85 } … … 109 112 if (argc == 2) { 110 113 uri = strdup(argv[1]); 111 filename = "./output";114 filename = 0; 112 115 } 113 116 … … 115 118 uri = strdup(argv[1]); 116 119 filename = strdup(argv[2]); 120 fout = fopen(filename,"w"); 117 121 } 118 119 fout = fopen(filename,"w"); 122 120 123 // create an trace to uri 121 124 trace = trace_create(uri); … … 135 138 counter[BYTES] += ntohs(erfptr->rlen); 136 139 counter[PACKETS] ++; 140 counter[LOSS] += ntohs(erfptr->lctr); 137 141 138 142 if(docalc) { 139 143 secondreport(); 140 144 } 141 142 fwrite(erfptr,psize,1,fout); 145 146 if (filename) 147 fwrite(erfptr,psize,1,fout); 143 148 144 149
Note: See TracChangeset
for help on using the changeset viewer.