4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 33dff53 was
d4336d5,
checked in by Shane Alcock <salcock@…>, 15 years ago
|
Updated tracereport to include all the work Josef has done
|
-
Property mode set to
100644
|
File size:
949 bytes
|
Rev | Line | |
---|
[49ce177] | 1 | #include <netdb.h> |
---|
| 2 | #include <inttypes.h> |
---|
[e3b0188] | 3 | #include <lt_inttypes.h> |
---|
[49ce177] | 4 | #include <stdio.h> |
---|
| 5 | #include "libtrace.h" |
---|
| 6 | #include "tracereport.h" |
---|
| 7 | |
---|
| 8 | static uint64_t dir_bytes[8]; |
---|
| 9 | static uint64_t dir_packets[8]; |
---|
| 10 | |
---|
| 11 | void dir_per_packet(struct libtrace_packet_t *packet) |
---|
| 12 | { |
---|
[d4336d5] | 13 | if (trace_get_direction(packet)==-1) |
---|
[3b49843] | 14 | return; |
---|
[49ce177] | 15 | dir_bytes[trace_get_direction(packet)]+=trace_get_wire_length(packet); |
---|
| 16 | ++dir_packets[trace_get_direction(packet)]; |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | void dir_report(void) |
---|
| 20 | { |
---|
| 21 | int i; |
---|
| 22 | printf("# Direction\n"); |
---|
| 23 | printf("%-20s \t%12s\t%12s\n","Direction","bytes","packets"); |
---|
| 24 | for(i=0;i<8;++i) { |
---|
| 25 | if (!dir_packets[i]) |
---|
| 26 | continue; |
---|
| 27 | switch(i) { |
---|
| 28 | case 0: printf("%20s:\t%12" PRIu64 "\t%12" PRIu64 "\n", |
---|
| 29 | "in",dir_bytes[i],dir_packets[i]); |
---|
| 30 | break; |
---|
| 31 | case 1: printf("%20s:\t%12" PRIu64 "\t%12" PRIu64 "\n", |
---|
| 32 | "out",dir_bytes[i],dir_packets[i]); |
---|
| 33 | break; |
---|
| 34 | default: printf("%20i:\t%12" PRIu64 "\t%12" PRIu64 "\n", |
---|
| 35 | i,dir_bytes[i],dir_packets[i]); |
---|
| 36 | break; |
---|
| 37 | } |
---|
| 38 | } |
---|
| 39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.